package org.jeecg.modules.hxrencai.controller;

import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.hssf.usermodel.*;
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.exception.JeecgBootException;
import org.jeecg.common.util.UUIDGenerator;
import org.jeecg.modules.hxrencai.entity.School;
import org.jeecg.modules.hxrencai.entity.StudyPark;
import org.jeecg.modules.hxrencai.entity.University;
import org.jeecg.modules.hxrencai.service.ISchoolService;
import org.jeecg.modules.hxrencai.service.IStudyParkService;
import org.jeecg.modules.hxrencai.service.IUniversityService;
import org.jeecg.modules.rencai.entity.*;
import org.jeecg.modules.rencai.service.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.FileInputStream;
import java.io.InputStream;
import java.math.BigDecimal;
import java.text.NumberFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;

@Slf4j
@Api(tags = "数据接口")
@RestController
@RequestMapping("/dataImport")
public class DataImportController {
    //旧版导入
    @Autowired
    private IStudyParkService studyParkService;
    @Autowired
    private IUniversityService universityService;
    @Autowired
    private ISchoolService schoolService;
    //新版导入
    @Autowired
    private IBaseParkService baseParkService;
    @Autowired
    private IEduInfoService eduInfoService;
    @Autowired
    private IEduStationService eduStationService;
    @Autowired
    private IInstituteService instituteService;
    @Autowired
    private IEduSummaryService eduSummaryService;

    //    @ApiOperation("数据导入")
//    @GetMapping(value = "/{type}")
    public void exportRestData(HttpServletRequest request, HttpServletResponse response, @PathVariable String type) {
        switch (type) {
            case "1":
                readRencaiOne(response);
                break;
            case "2":
                readRencaiTwo(response);
                break;
            case "3":
                readRencaiThree(response);
                break;
            case "4":
                readRencaiFour(response);
                break;
            case "5":
                readRencaiFive(response);
                break;
            case "6":
                readRencaiSix(response);
                break;
            default:
        }
    }

    private List<University> readRencaiGzList(String filePath, int sheetIndex, int startRowNum) {
        List<University> list = new ArrayList<University>();
        try {
            InputStream is = new FileInputStream(filePath);
            HSSFWorkbook hssfWorkbook = new HSSFWorkbook(is);
            HSSFSheet hssfSheet = hssfWorkbook.getSheetAt(sheetIndex);
            String areaName = "";
            String serial = "";
            String college = "";
            String schoolName = "";
            String realnum = "";
            for (int rowNum = startRowNum; rowNum <= hssfSheet.getLastRowNum(); rowNum++) {
                HSSFRow hssfRow = hssfSheet.getRow(rowNum);
                if (hssfRow == null) {
                    continue;
                }
                University gz = new University();
                gz.setSerial(getValue(hssfRow.getCell(0)));
                gz.setSchoolName(getValue(hssfRow.getCell(1)));
                gz.setArea(getValue(hssfRow.getCell(2)));
                gz.setCollege(getValue(hssfRow.getCell(3)));
                gz.setProfession(getValue(hssfRow.getCell(4)));
                gz.setProfessionNum(getValue(hssfRow.getCell(5)));
                if (StringUtils.isNotBlank(gz.getSerial())) {
                    serial = gz.getSerial();
                } else {
                    gz.setSerial(serial);
                }
                if (StringUtils.isNotBlank(gz.getSchoolName())) {
                    college = "";
                    schoolName = gz.getSchoolName();
                } else {
                    gz.setSchoolName(schoolName);
                }
                if (StringUtils.isNotBlank(gz.getArea())) {
                    areaName = gz.getArea();
                } else {
                    gz.setArea(areaName);
                }
                if (StringUtils.isNotBlank(gz.getCollege())) {
                    college = gz.getCollege();
                    realnum = "";
                } else {
                    gz.setCollege(college);
                }
//                String num = getValue(hssfRow.getCell(5));
//                if (StringUtils.isBlank(num) && list.size() == 0) {
//                    gz.setProfessionNum(num);
//                } else if (StringUtils.isBlank(num) && StringUtils.isBlank(realnum)) {
//                    University lastOne = list.get(rowNum - startRowNum - 1);
//                    realnum = lastOne.getProfessionNum();
//                    gz.setProfessionNum(realnum);
//                } else if (StringUtils.isBlank(num)) {
//                    gz.setProfessionNum(realnum);
//                } else {
//                    gz.setProfessionNum(num);
//                }

                if (StringUtils.isBlank(gz.getSchoolName())) {
                    continue;
                }
                if (StringUtils.isNotBlank(gz.getProfessionNum()) && (StringUtils.trimToEmpty(gz.getProfessionNum()).startsWith("-") || StringUtils.trimToEmpty(gz.getProfessionNum()).equals("—"))) {
                    gz.setProfessionNum(null);
                }
                if (StringUtils.isNotBlank(gz.getProfession()) && StringUtils.trimToEmpty(gz.getProfession()).equals("—")) {
                    //数据未找到
                    gz.setProfession("");
                }
                gz.setId(UUIDGenerator.generate());
                list.add(gz);
            }
            int skipIndex = 0;
            for (int i = 0; i < list.size(); i++) {
                if (i < skipIndex) {
                    continue;
                }
                skipIndex = i + 1 + processIndex(i, list);
            }
        } catch (Exception e) {
            e.printStackTrace();
            return new ArrayList<University>();
        }
        return list;
    }

    private int processIndex(int index, List<University> list) {
        University indexOne = list.get(index);
        int batch = 0;
        if (StringUtils.isBlank(indexOne.getProfessionNum())) {
            return batch;
        }
        List<Integer> group = new ArrayList<>();
        String mergeid = indexOne.getId() + ",";
        while (true) {
            index++;
            if (index >= list.size()) {
                break;
            }
            University nextOne = list.get(index);
            if (nextOne.getCollege().equals(indexOne.getCollege()) && StringUtils.isBlank(nextOne.getProfessionNum())) {
                batch++;
                mergeid += nextOne.getId() + ",";
                group.add(index);
            } else {
                break;
            }
        }
        for (Integer it : group) {
            University thit = list.get(it);
            thit.setProfessionNum(null);
            thit.setIsMerge("1");
            thit.setMergeNum(indexOne.getProfessionNum());
            thit.setMergeId(mergeid);
        }

        if (group.size() > 0) {
            indexOne.setMergeNum(indexOne.getProfessionNum());
            //indexOne.setProfessionNum(null);
            indexOne.setIsMerge("1");
            indexOne.setMergeId(mergeid);
        }
        return batch;
    }

    private int processIndex2(int index, List<University> list) {
        University indexOne = list.get(index);
        int batch = 0;
        if (StringUtils.isBlank(indexOne.getProfessionNum())) {
            return batch;
        }
        List<Integer> group = new ArrayList<>();
        String mergeid = indexOne.getId() + ",";
        while (true) {
            index++;
            if (index >= list.size()) {
                break;
            }
            University nextOne = list.get(index);
            if (StringUtils.isBlank(nextOne.getProfessionNum())) {
                batch++;
                mergeid += nextOne.getId() + ",";
                group.add(index);
            } else {
                break;
            }
        }
        for (Integer it : group) {
            University thit = list.get(it);
            thit.setProfessionNum(null);
            thit.setIsMerge("1");
            thit.setMergeNum(indexOne.getProfessionNum());
            thit.setMergeId(mergeid);
        }

        if (group.size() > 0) {
            indexOne.setMergeNum(indexOne.getProfessionNum());
            //indexOne.setProfessionNum(null);
            indexOne.setIsMerge("1");
            indexOne.setMergeId(mergeid);
        }
        return batch;
    }

    private void readRencaiOne(HttpServletResponse response) {
        String filePath = "D:\\data\\副本福建开设机械装备产业相关专业的高职院校（29所）(5).xls";
        List<University> list = readRencaiGzList(filePath, 0, 2);
        list.forEach(e -> e.setImportType("1"));
        try {
            if (list.size() == 0) {
                return;
            }
//            boolean isOk = universityService.saveBatch(list);
//            if (!isOk) {
//                throw new JeecgBootException("失败");
//            }
        } catch (Exception e) {
            throw new JeecgBootException(e);
        }
    }


    private void readRencaiTwo(HttpServletResponse response) {
        String filePath = "D:\\data\\副本福建省开设机械装备产业相关专业的本科院校（25所）(2).xls";
        List<University> list = readRencaiGzList(filePath, 0, 2);
        list.forEach(e -> e.setImportType("2"));
        try {
            if (list.size() == 0) {
                return;
            }
//            boolean isOk = universityService.saveBatch(list);
//            if (!isOk) {
//                throw new JeecgBootException("失败");
//            }
        } catch (Exception e) {
            throw new JeecgBootException(e);
        }
    }

    private void readRencaiThree(HttpServletResponse response) {
        String filePath = "D:\\data\\副本全国机械装备产业园区、基地分布情况（344所）(3).xls";
        try {
            InputStream is = new FileInputStream(filePath);
            HSSFWorkbook hssfWorkbook = new HSSFWorkbook(is);
            HSSFSheet hssfSheet = hssfWorkbook.getSheetAt(0);
            List<StudyPark> list = new ArrayList<StudyPark>();
            String areaNum = "";
            for (int rowNum = 2; rowNum <= hssfSheet.getLastRowNum(); rowNum++) {
                HSSFRow hssfRow = hssfSheet.getRow(rowNum);
                if (hssfRow == null) {
                    continue;
                }
                StudyPark yq = new StudyPark();
                yq.setFlag("1");
                yq.setSerial(getValue(hssfRow.getCell(0)));
                yq.setName(getValue(hssfRow.getCell(1)));
                yq.setArea(getValue(hssfRow.getCell(2)));
                yq.setType(getValue(hssfRow.getCell(3)));
                list.add(yq);
            }
            list.forEach(e -> {
                e.setId(UUIDGenerator.generate());
                e.setFlag("1");
                e.setImportType("3");
            });
            System.out.println(list);
//            studyParkService.saveBatch(list);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    private void readRencaiFour(HttpServletResponse response) {
        String filePath = "D:\\data\\副本全国机械装备研究院（所）信息一览表（417所）(2).xls";
        try {
            InputStream is = new FileInputStream(filePath);
            HSSFWorkbook hssfWorkbook = new HSSFWorkbook(is);
            HSSFSheet hssfSheet = hssfWorkbook.getSheetAt(0);
            List<StudyPark> list = new ArrayList<StudyPark>();
            for (int rowNum = 2; rowNum <= hssfSheet.getLastRowNum(); rowNum++) {
                HSSFRow hssfRow = hssfSheet.getRow(rowNum);
                if (hssfRow == null) {
                    continue;
                }
                StudyPark yl = new StudyPark();
                yl.setFlag("2");
                yl.setSerial(getValue(hssfRow.getCell(0)));
                yl.setArea(getValue(hssfRow.getCell(1)));
                yl.setName(getValue(hssfRow.getCell(2)));
                yl.setType(getValue(hssfRow.getCell(3)));
                list.add(yl);
            }
            list.forEach(e -> {
                e.setId(UUIDGenerator.generate());
                e.setFlag("2");
                e.setImportType("4");
            });
            System.out.println(list);
//            studyParkService.saveBatch(list);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    private void readRencaiFive(HttpServletResponse response) {
//        LambdaQueryWrapper<University> queryWrapper = new LambdaQueryWrapper();
//        queryWrapper.eq(University::getImportType,"5");
//        universityService.remove(queryWrapper);
        String filePath = "D:\\data\\全国机械装备产业本科院校名单2.xls";
        List<University> list = readRencaiGzList(filePath, 0, 2);
        list.forEach(e -> e.setImportType("5"));
        try {
            if (list.size() == 0) {
                return;
            }
//            boolean isOk = universityService.saveBatch(list);
//            if (!isOk) {
//                throw new JeecgBootException("失败");
//            }
        } catch (Exception e) {
            throw new JeecgBootException(e);
        }
    }

    private void readRencaiSix(HttpServletResponse response) {
        String filePath = "D:\\data\\副本福建省开设机械装备产业相关专业的中职院校（128所）(1).xls";
        List<University> list = new ArrayList<University>();
        try {
            InputStream is = new FileInputStream(filePath);
            HSSFWorkbook hssfWorkbook = new HSSFWorkbook(is);
            HSSFSheet hssfSheet = hssfWorkbook.getSheetAt(0);
            String areaName = "";
            String serial = "";
            String college = "";
            String schoolName = "";
            String realnum = "";
            for (int rowNum = 2; rowNum <= hssfSheet.getLastRowNum(); rowNum++) {
                HSSFRow hssfRow = hssfSheet.getRow(rowNum);
                if (hssfRow == null) {
                    continue;
                }
                University gz = new University();
                gz.setSerial(getValue(hssfRow.getCell(0)));
                gz.setSchoolName(getValue(hssfRow.getCell(1)));
                gz.setArea(getValue(hssfRow.getCell(2)));
                gz.setProfession(getValue(hssfRow.getCell(3)));
                gz.setProfessionNum(getValue(hssfRow.getCell(4)));
                if (StringUtils.isNotBlank(gz.getSerial())) {
                    serial = gz.getSerial();
                } else {
                    gz.setSerial(serial);
                }
                if (StringUtils.isNotBlank(gz.getSchoolName())) {
                    college = "";
                    schoolName = gz.getSchoolName();
                } else {
                    gz.setSchoolName(schoolName);
                }
                if (StringUtils.isNotBlank(gz.getArea())) {
                    areaName = gz.getArea();
                } else {
                    gz.setArea(areaName);
                }
//                if (StringUtils.isNotBlank(gz.getCollege())) {
//                    college = gz.getCollege();
//                    realnum = "";
//                } else {
//                    gz.setCollege(college);
//                }
//                String num = getValue(hssfRow.getCell(5));
//                if (StringUtils.isBlank(num) && list.size() == 0) {
//                    gz.setProfessionNum(num);
//                } else if (StringUtils.isBlank(num) && StringUtils.isBlank(realnum)) {
//                    University lastOne = list.get(rowNum - startRowNum - 1);
//                    realnum = lastOne.getProfessionNum();
//                    gz.setProfessionNum(realnum);
//                } else if (StringUtils.isBlank(num)) {
//                    gz.setProfessionNum(realnum);
//                } else {
//                    gz.setProfessionNum(num);
//                }
                if (StringUtils.isBlank(gz.getSchoolName())) {
                    continue;
                }
                if (StringUtils.isNotBlank(gz.getProfession()) && StringUtils.trimToEmpty(gz.getProfession()).equals("—")) {
                    //数据未找到
                    gz.setProfession("");
                }
                gz.setId(UUIDGenerator.generate());
                list.add(gz);
            }
            int skipIndex = 0;
            for (int i = 0; i < list.size(); i++) {
                if (i < skipIndex) {
                    continue;
                }
                skipIndex = i + 1 + processIndex2(i, list);
                University gz = list.get(i);
                if (StringUtils.isNotBlank(gz.getProfessionNum()) && (StringUtils.trimToEmpty(gz.getProfessionNum()).startsWith("-") || StringUtils.trimToEmpty(gz.getProfessionNum()).equals("—"))) {
                    gz.setProfessionNum(null);
                }
            }

            list.forEach(e -> e.setImportType("6"));
            if (list.size() == 0) {
                return;
            }
//            boolean isOk = universityService.saveBatch(list);
//            if (!isOk) {
//                throw new JeecgBootException("失败");
//            }

        } catch (Exception e) {
            e.printStackTrace();
            throw new JeecgBootException(e);
        }
    }

    private static String getValue(HSSFCell hssfCell) {
        String value = "";
        if (hssfCell == null) {
            return null;
        }
        if (hssfCell.getCellType() == HSSFCell.CELL_TYPE_BLANK) {
            // 返回布尔类型的值
            return String.valueOf("");
        } else if (hssfCell.getCellType() == HSSFCell.CELL_TYPE_NUMERIC) {
            // 返回数值类型的值
            NumberFormat format = NumberFormat.getInstance();
            format.setMinimumFractionDigits(0);// 设置数值的小数部分允许的最小位数。
            format.setMaximumFractionDigits(9);// 设置数值的小数部分允许的最大位数。
            value = format.format(hssfCell.getNumericCellValue());// 将末尾的0去掉。使单元格内容“1”，读取到的“1.00”变成“1”
            value = value.replace(",", "");
        } else if (hssfCell.getCellType() == HSSFCell.CELL_TYPE_STRING) {
            //|| hssfCell.getCellType() == HSSFCell.CELL_TYPE_FORMULA) {// XSSFCell与HSSFCell值相同
            value = hssfCell.getStringCellValue();
        } else if (hssfCell.getCellType() == HSSFCell.CELL_TYPE_FORMULA) {
            try {
                value = String.valueOf(hssfCell.getNumericCellValue());
            } catch (IllegalStateException e) {
                value = String.valueOf(hssfCell.getRichStringCellValue());
            }
        }
        return value.trim();
    }

    //    @ApiOperation("学校导入")
//    @GetMapping(value = "/handleData")
    public Result<?> handleData() {
        LambdaQueryWrapper<University> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(University::getImportType, "5");
        List<University> list1 = universityService.list(queryWrapper);
        Set<String> set = new HashSet<>();
        for (University university : list1) {
            if (!set.contains(university.getSchoolName())) {
                School school = new School();
                school.setId(UUIDGenerator.generate());
                school.setProvince(university.getArea());
                school.setSchoolName(university.getSchoolName());
                school.setType("1");
                schoolService.save(school);
                set.add(university.getSchoolName());
            }
        }
        queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(University::getImportType, "2");
        List<University> list2 = universityService.list(queryWrapper);
        set = new HashSet<>();
        for (University university : list2) {
            if (!set.contains(university.getSchoolName())) {
                School school = new School();
                school.setId(UUIDGenerator.generate());
                school.setProvince("福建省");
                school.setCity(university.getArea());
                school.setSchoolName(university.getSchoolName());
                school.setType("1");
                schoolService.save(school);
                set.add(university.getSchoolName());
            }
        }

        queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(University::getImportType, "1");
        List<University> list3 = universityService.list(queryWrapper);
        set = new HashSet<>();
        for (University university : list3) {
            if (!set.contains(university.getSchoolName())) {
                School school = new School();
                school.setId(UUIDGenerator.generate());
                school.setProvince("福建省");
                school.setCity(university.getArea());
                school.setSchoolName(university.getSchoolName());
                school.setType("2");
                schoolService.save(school);
                set.add(university.getSchoolName());
            }
        }


        queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(University::getImportType, "6");
        List<University> list4 = universityService.list(queryWrapper);
        set = new HashSet<>();
        for (University university : list4) {
            if (!set.contains(university.getSchoolName())) {
                School school = new School();
                school.setId(UUIDGenerator.generate());
                school.setProvince("福建省");
                school.setCity(university.getArea());
                school.setSchoolName(university.getSchoolName());
                school.setType("3");
                schoolService.save(school);
                set.add(university.getSchoolName());
            }
        }
        return Result.ok();
    }


    /**
     * 新版导入
     */

//    @ApiOperation("导入新版研究院")
//    @GetMapping(value = "/importNewInstitute")
    public Result<?> importNewInstitute() {
        String filePath = "E:\\征信云\\hxrencai\\全国机械装备研究院（所）信息一览表（416所）.xls";
        List<Institute> instituteList = new ArrayList<>();
        try {

            InputStream is = new FileInputStream(filePath);
            HSSFWorkbook hssfWorkbook = new HSSFWorkbook(is);
            if (hssfWorkbook == null) {
                return Result.error("文件出错");
            }
            HSSFSheet hssfSheet = hssfWorkbook.getSheetAt(0);
            for (int rowNum = 2; rowNum <= hssfSheet.getLastRowNum(); rowNum++) {
                HSSFRow hssfRow = hssfSheet.getRow(rowNum);
                if (hssfRow == null) {
                    continue;
                }
                Institute gz = new Institute();
                gz.setId(UUIDGenerator.generate());
                gz.setProvince(getValue(hssfRow.getCell(1)));
                gz.setCity(getValue(hssfRow.getCell(2)));
                gz.setInstituteName(getValue(hssfRow.getCell(3)));
                gz.setType(getValue(hssfRow.getCell(4)));
                instituteList.add(gz);
            }
            instituteService.saveBatch(instituteList);
        } catch (Exception e) {
            return Result.error(e.getMessage());
        }
        return Result.ok("导入成功");
    }


    //    @ApiOperation("导入新版 基地园区")
//    @GetMapping(value = "/importNewBasePark")
    public Result<?> importNewBasePark() {
        String filePath = "E:\\征信云\\hxrencai\\全国机械装备产业园区、基地分布情况.xls";
        List<BasePark> baseParkList = new ArrayList<>();
        try {

            InputStream is = new FileInputStream(filePath);
            HSSFWorkbook hssfWorkbook = new HSSFWorkbook(is);
            if (hssfWorkbook == null) {
                return Result.error("文件出错");
            }
            HSSFSheet hssfSheet = hssfWorkbook.getSheetAt(0);
            for (int rowNum = 2; rowNum <= hssfSheet.getLastRowNum(); rowNum++) {
                HSSFRow hssfRow = hssfSheet.getRow(rowNum);
                if (hssfRow == null) {
                    continue;
                }
                BasePark gz = new BasePark();
                gz.setId(UUIDGenerator.generate());
                String province = getValue(hssfRow.getCell(2));
                if (StringUtils.isNotBlank(province) && (province.endsWith("省")) || province.endsWith("市")) {
                    province = province.substring(0, province.length() - 1);
                }
                gz.setProvince(province);
                HSSFHyperlink hyperlink = hssfRow.getCell(1).getHyperlink();
                if (hyperlink != null) {
                    gz.setUrl(hyperlink.getAddress());
                }
                gz.setParkName(getValue(hssfRow.getCell(1)));
                gz.setType(getValue(hssfRow.getCell(3)));
                baseParkList.add(gz);
            }
            baseParkService.saveBatch(baseParkList);
        } catch (Exception e) {
            return Result.error(e.getMessage());
        }
        return Result.ok("导入成功");
    }


//    @ApiOperation("导入新版 学校")
//    @GetMapping(value = "/importNewEdu")
//    public Result<?> importNewEdu(@RequestParam int index) {
//        String filePath = "";
//        int areaIndex = 0;
//        switch (index) {
//            case 1:
//                filePath = "E:\\征信云\\hxrencai\\福建省开设机械装备产业相关专业的本科院校（25所）.xls";
//                break;
//            case 2:
//                filePath = "E:\\征信云\\hxrencai\\福建开设机械装备产业相关专业的高职院校（29所）.xls";
//                break;
//            case 3:
//                filePath = "E:\\征信云\\hxrencai\\福建省开设机械装备产业相关专业的中职院校（128所）.xls";
//                areaIndex = 2;
//                break;
//            case 4:
//                filePath = "E:\\征信云\\hxrencai\\全国机械装备产业本科院校名单.xls";
//                break;
//        }
//        String type = index + "";
//        try {
//            List<EduStation> stationList = new ArrayList<>();
//            InputStream is = new FileInputStream(filePath);
//            HSSFWorkbook hssfWorkbook = new HSSFWorkbook(is);
//            if (hssfWorkbook == null) {
//                return Result.error("文件出错");
//            }
//            String area = "";
//
//            HSSFSheet hssfSheet = hssfWorkbook.getSheetAt(0);
//            for (int rowNum = 2; rowNum <= hssfSheet.getLastRowNum(); rowNum++) {
//                HSSFRow hssfRow = hssfSheet.getRow(rowNum);
//                if (hssfRow == null) {
//                    continue;
//                }
//                EduStation gz = new EduStation();
//                gz.setId(UUIDGenerator.generate());
//
//                String areaExcel = getValue(hssfRow.getCell(areaIndex));
//                if (StringUtils.isNotBlank(areaExcel)) {
//                    area = areaExcel;
//                }
//                gz.setArea(area);
//                gz.setSchoolNature(getValue(hssfRow.getCell(4)));
//                gz.setSchoolName(getValue(hssfRow.getCell(3)));
//                gz.setStudentNum(getValue(hssfRow.getCell(5)));
//                gz.setContactWay(getValue(hssfRow.getCell(6)));
//                gz.setType(type);
//                stationList.add(gz);
//            }
//            eduStationService.saveBatch(stationList);
//        } catch (Exception e) {
//            return Result.error(e.getMessage());
//        }
//        return Result.ok("导入成功");
//    }


    //    @ApiOperation("导入新版 全国本科")
//    @GetMapping(value = "/importNewQGBK")
    public Result<?> importNewQGBK() {
        String filePath = "E:\\征信云\\hxrencai\\全国机械装备产业本科院校名单.xls";
        List<EduStation> stationList = new ArrayList<>();
        try {
            InputStream is = new FileInputStream(filePath);
            HSSFWorkbook hssfWorkbook = new HSSFWorkbook(is);
            if (hssfWorkbook == null) {
                return Result.error("文件出错");
            }
            String area = "";

            HSSFSheet hssfSheet = hssfWorkbook.getSheetAt(0);
            for (int rowNum = 2; rowNum <= hssfSheet.getLastRowNum(); rowNum++) {
                HSSFRow hssfRow = hssfSheet.getRow(rowNum);
                if (hssfRow == null) {
                    continue;
                }
                String schoolName = getValue(hssfRow.getCell(1));
                if (StringUtils.isBlank(schoolName)) {
                    continue;
                }
                EduStation gz = new EduStation();
                gz.setId(UUIDGenerator.generate());

                String areaExcel = getValue(hssfRow.getCell(2));
                if (StringUtils.isNotBlank(areaExcel)) {
                    area = areaExcel;
                }
                gz.setProvince(areaExcel);
                gz.setSchoolName(schoolName);
                gz.setSchoolNature(getValue(hssfRow.getCell(3)));
                gz.setStudentNum(getValue(hssfRow.getCell(7)));
                gz.setContactWay(getValue(hssfRow.getCell(8)));
                gz.setType("4");
                stationList.add(gz);
            }
            eduStationService.saveBatch(stationList);
        } catch (Exception e) {
            return Result.error(e.getMessage());
        }
        return Result.ok("导入成功");
    }


    //    @ApiOperation("导入新版 福建中职")
//    @GetMapping(value = "/importNewFJZZ")
    public Result<?> importNewFJZZ() {
        String filePath = "E:\\征信云\\hxrencai\\福建省开设机械装备产业相关专业的中职院校（128所）.xls";
        List<EduStation> stationList = new ArrayList<>();
        try {
            InputStream is = new FileInputStream(filePath);
            HSSFWorkbook hssfWorkbook = new HSSFWorkbook(is);
            if (hssfWorkbook == null) {
                return Result.error("文件出错");
            }
            String area = "";

            HSSFSheet hssfSheet = hssfWorkbook.getSheetAt(0);
            for (int rowNum = 2; rowNum <= hssfSheet.getLastRowNum(); rowNum++) {
                HSSFRow hssfRow = hssfSheet.getRow(rowNum);
                if (hssfRow == null) {
                    continue;
                }
                String schoolName = getValue(hssfRow.getCell(1));
                if (StringUtils.isBlank(schoolName)) {
                    continue;
                }
                EduStation gz = new EduStation();
                gz.setId(UUIDGenerator.generate());
                String areaExcel = getValue(hssfRow.getCell(2));
                if (StringUtils.isNotBlank(areaExcel)) {
                    area = areaExcel;
                }
                gz.setCity(area);
                gz.setProvince("福建");
                gz.setSchoolName(schoolName);
                String num = getValue(hssfRow.getCell(5));
                if (StringUtils.isNotBlank(num) && !"暂无数据".equals(num.trim())) {
                    num = new BigDecimal(num).setScale(0, BigDecimal.ROUND_HALF_DOWN).intValue() + "";
                }
                gz.setStudentNum(num);
                gz.setContactWay(getValue(hssfRow.getCell(6)));
                gz.setType("3");
                stationList.add(gz);
            }
            eduStationService.saveBatch(stationList);
        } catch (Exception e) {
            return Result.error(e.getMessage());
        }
        return Result.ok("导入成功");
    }


    //    @ApiOperation("导入新版 福建高职")
//    @GetMapping(value = "/importNewFJGZ")
    public Result<?> importNewFJGZ() {
        String filePath = "E:\\征信云\\hxrencai\\福建开设机械装备产业相关专业的高职院校（29所）.xls";
        List<EduStation> stationList = new ArrayList<>();
        try {
            InputStream is = new FileInputStream(filePath);
            HSSFWorkbook hssfWorkbook = new HSSFWorkbook(is);
            if (hssfWorkbook == null) {
                return Result.error("文件出错");
            }
            String area = "";

            HSSFSheet hssfSheet = hssfWorkbook.getSheetAt(0);
            for (int rowNum = 2; rowNum <= hssfSheet.getLastRowNum(); rowNum++) {
                HSSFRow hssfRow = hssfSheet.getRow(rowNum);
                if (hssfRow == null) {
                    continue;
                }
                String schoolName = getValue(hssfRow.getCell(3));
                if (StringUtils.isBlank(schoolName)) {
                    continue;
                }
                EduStation gz = new EduStation();
                gz.setId(UUIDGenerator.generate());
                String areaExcel = getValue(hssfRow.getCell(1));
                if (StringUtils.isNotBlank(areaExcel)) {
                    area = areaExcel;
                }
                gz.setCity(area);
                gz.setProvince("福建");
                gz.setSchoolName(schoolName);
                gz.setStudentNum(getValue(hssfRow.getCell(4)));
                gz.setContactWay(getValue(hssfRow.getCell(5)));
                gz.setType("2");
                stationList.add(gz);
            }
            eduStationService.saveBatch(stationList);
        } catch (Exception e) {
            return Result.error(e.getMessage());
        }
        return Result.ok("导入成功");
    }


    //    @ApiOperation("导入新版 福建本科")
//    @GetMapping(value = "/importNewFJBK")
    public Result<?> importNewFJBK() {
        String filePath = "E:\\征信云\\hxrencai\\福建省开设机械装备产业相关专业的本科院校（25所）.xls";
        List<EduStation> stationList = new ArrayList<>();
        try {
            InputStream is = new FileInputStream(filePath);
            HSSFWorkbook hssfWorkbook = new HSSFWorkbook(is);
            if (hssfWorkbook == null) {
                return Result.error("文件出错");
            }
            String area = "";

            HSSFSheet hssfSheet = hssfWorkbook.getSheetAt(0);
            for (int rowNum = 2; rowNum <= hssfSheet.getLastRowNum(); rowNum++) {
                HSSFRow hssfRow = hssfSheet.getRow(rowNum);
                if (hssfRow == null) {
                    continue;
                }
                String schoolName = getValue(hssfRow.getCell(3));
                if (StringUtils.isBlank(schoolName)) {
                    continue;
                }
                EduStation gz = new EduStation();
                gz.setId(UUIDGenerator.generate());
                String areaExcel = getValue(hssfRow.getCell(1));
                if (StringUtils.isNotBlank(areaExcel)) {
                    area = areaExcel;
                }
                gz.setCity(area);
                gz.setProvince("福建");
                gz.setSchoolNature(getValue(hssfRow.getCell(4)));
                gz.setSchoolName(schoolName);
                gz.setStudentNum(getValue(hssfRow.getCell(5)));
                gz.setContactWay(getValue(hssfRow.getCell(6)));
                gz.setType("1");
                stationList.add(gz);
            }
            eduStationService.saveBatch(stationList);
        } catch (Exception e) {
            return Result.error(e.getMessage());
        }
        return Result.ok("导入成功");
    }


    //    @ApiOperation("导入新版 学校详情 全国本科")
//    @GetMapping(value = "/importNewQgbkInfo")
    public Result<?> importNewQgbkInfo() {
        String filePath = "E:\\征信云\\hxrencai\\全国机械装备产业本科院校名单.xls";
        List<EduInfo> stationList = new ArrayList<>();
        try {

            InputStream is = new FileInputStream(filePath);
            HSSFWorkbook hssfWorkbook = new HSSFWorkbook(is);
            if (hssfWorkbook == null) {
                return Result.error("文件出错");
            }
            String area = "";
            String college = "";
            String schoolName = "";
            HSSFSheet hssfSheet = hssfWorkbook.getSheetAt(0);
            for (int rowNum = 2; rowNum <= hssfSheet.getLastRowNum(); rowNum++) {
                HSSFRow hssfRow = hssfSheet.getRow(rowNum);
                if (hssfRow == null) {
                    continue;
                }
                EduInfo gz = new EduInfo();
//                String areaExcel = getValue(hssfRow.getCell(2));
//                if (StringUtils.isNotBlank(areaExcel)) {
//                    area = areaExcel;
//                }
                String school = getValue(hssfRow.getCell(1));
                if (StringUtils.isNoneBlank(school)) {
                    schoolName = school;
                } else {
                    school = schoolName;
                }
                EduStation station = eduStationService.getOne(new LambdaQueryWrapper<EduStation>().eq(EduStation::getType, "4").eq(EduStation::getSchoolName, school));
                if (ObjectUtil.isNotEmpty(station)) {
                    gz.setSchoolId(station.getId());
                } else {
                    throw new JeecgBootException("学校不存在");
                }
                gz.setSchoolName(station.getSchoolName());
                gz.setStudentNum(getValue(hssfRow.getCell(6)));
                String collegeExcel = getValue(hssfRow.getCell(4));
                if (StringUtils.isNotBlank(collegeExcel)) {
                    college = collegeExcel;
                } else {
                    collegeExcel = college;
                }
                gz.setCollege(collegeExcel);
                gz.setProfession(getValue(hssfRow.getCell(5)));
                gz.setId(UUIDGenerator.generate());
                gz.setType("4");
                stationList.add(gz);
            }
            eduInfoService.saveBatch(stationList);
        } catch (Exception e) {
            return Result.error(e.getMessage());
        }
        return Result.ok("导入成功");
    }


    //    @ApiOperation("导入新版 学校详情 福建中职")
//    @GetMapping(value = "/importNewFjzzInfo")
    public Result<?> importNewFjzzInfo() {
        String filePath = "E:\\征信云\\hxrencai\\福建省开设机械装备产业相关专业的中职院校（128所）.xls";
        List<EduInfo> stationList = new ArrayList<>();
        try {
            InputStream is = new FileInputStream(filePath);
            HSSFWorkbook hssfWorkbook = new HSSFWorkbook(is);
            if (hssfWorkbook == null) {
                return Result.error("文件出错");
            }
            String area = "";
            String college = "";
            String schoolName = "";
            HSSFSheet hssfSheet = hssfWorkbook.getSheetAt(0);
            for (int rowNum = 2; rowNum <= hssfSheet.getLastRowNum(); rowNum++) {
                HSSFRow hssfRow = hssfSheet.getRow(rowNum);
                if (hssfRow == null) {
                    continue;
                }
                EduInfo gz = new EduInfo();
//                String areaExcel = getValue(hssfRow.getCell(2));
//                if (StringUtils.isNotBlank(areaExcel)) {
//                    area = areaExcel;
//                }
                String school = getValue(hssfRow.getCell(1));
                if (StringUtils.isNotBlank(school)) {
                    schoolName = school;
                } else {
                    school = schoolName;
                }
                EduStation station = eduStationService.getOne(new LambdaQueryWrapper<EduStation>().eq(EduStation::getType, "3").eq(EduStation::getSchoolName, school));
                if (ObjectUtil.isNotEmpty(station)) {
                    gz.setSchoolId(station.getId());
                } else {
                    throw new JeecgBootException("学校不存在");
                }
                gz.setSchoolName(schoolName);
                gz.setStudentNum(getValue(hssfRow.getCell(4)));
                gz.setProfession(getValue(hssfRow.getCell(3)));
                gz.setId(UUIDGenerator.generate());
                gz.setType("3");
                stationList.add(gz);
            }
            eduInfoService.saveBatch(stationList);
        } catch (Exception e) {
            return Result.error(e.getMessage());
        }
        return Result.ok("导入成功");
    }


    /**
     * 4 .9  导入最新的数据
     */

//    @ApiOperation("导入新版 0409")
//    @GetMapping(value = "/import0409Data")
    public Result<?> import0409Data() {
        String filePath = "E:\\征信云\\hxrencai\\0408\\全国机械装备产业本科院校名单(2).xlsx";

        try {
            InputStream in = new FileInputStream(filePath);
            Workbook wb = new XSSFWorkbook(in);
            if (wb == null) {
                throw new JeecgBootException("文件不存在");
            }
            String school = "";
            String college = "";
            int total = 0;
            EduStation tmp = null;
            List<EduInfo> qgInfo = new ArrayList<>();
            List<EduStation> qgSchool = new ArrayList<>();
            Sheet sheet1 = wb.getSheet("全国机械装备产业本科院校名单");
            for (int rowNum = 2; rowNum <= sheet1.getLastRowNum(); rowNum++) {
                Row row = sheet1.getRow(rowNum);
                if (row == null) {
                    continue;
                }
                String schoolName = (String) getCellFormatValue(row.getCell(1));
                String professionName = (String) getCellFormatValue(row.getCell(5));
                if (StringUtils.isNotBlank(schoolName)) {
                    if (tmp != null) {
                        tmp.setStudentNum(total + "");
                        qgSchool.add(tmp);
                    }
                    if (StringUtils.isBlank(professionName)) {
                        continue;
                    }
                    total = 0;
                    school = schoolName;
                    tmp = new EduStation();
                    tmp.setId(UUIDGenerator.generate());
                    tmp.setSchoolName(schoolName);
                    tmp.setContactWay((String) getCellFormatValue(row.getCell(8)));
                    tmp.setSchoolNature((String) getCellFormatValue(row.getCell(3)));
                    tmp.setProvince((String) getCellFormatValue(row.getCell(2)));
                    tmp.setType("1");
                } else {
                    schoolName = school;
                }
                EduInfo info = new EduInfo();
                info.setId(UUIDGenerator.generate());
                String collegeName = (String) getCellFormatValue(row.getCell(4));
                if (StringUtils.isNotBlank(collegeName)) {
                    college = collegeName;
                } else {
                    collegeName = college;
                }
                info.setCollege(collegeName);
                String num = (String) getCellFormatValue(row.getCell(6));
                if (StringUtils.isNotBlank(num) && StringUtils.isNumeric(num)) {
                    total += Integer.valueOf(num);
                } else {
                    num = "0";
                }
                info.setProfession(professionName);
                info.setStudentNum(num);
                info.setSchoolId(tmp.getId());
                info.setSchoolName(schoolName);
                info.setType("1");
                qgInfo.add(info);

            }
            if (tmp != null) {
                tmp.setStudentNum(total + "");
                qgSchool.add(tmp);
            }
            log.info("全国本科信息：" + qgInfo.size());
            log.info("全国本科学校：" + qgSchool.size());


            List<EduInfo> bkInfo = new ArrayList<>();
            List<EduStation> bkSchool = new ArrayList<>();
            Sheet sheet2 = wb.getSheet("福建本科");
            tmp = null;
            school = "";
            college = "";
            total = 0;
            for (int rowNum = 2; rowNum <= sheet2.getLastRowNum(); rowNum++) {
                Row row = sheet2.getRow(rowNum);
                if (row == null) {
                    continue;
                }
                String schoolName = (String) getCellFormatValue(row.getCell(1));
                String professionName = (String) getCellFormatValue(row.getCell(4));
                if (StringUtils.isNotBlank(schoolName)) {
                    if (tmp != null) {
                        tmp.setStudentNum(total + "");
                        bkSchool.add(tmp);
                    }
                    if (StringUtils.isBlank(professionName)) {
                        continue;
                    }
                    total = 0;
                    school = schoolName;
                    tmp = new EduStation();
                    tmp.setId(UUIDGenerator.generate());
                    tmp.setSchoolName(schoolName);
                    tmp.setContactWay((String) getCellFormatValue(row.getCell(6)));
                    tmp.setCity((String) getCellFormatValue(row.getCell(2)));
                    tmp.setType("1");
                    tmp.setProvince("福建");
                } else {
                    schoolName = school;
                }
                EduInfo info = new EduInfo();
                info.setId(UUIDGenerator.generate());
                String collegeName = (String) getCellFormatValue(row.getCell(3));
                if (StringUtils.isNotBlank(collegeName)) {
                    college = collegeName;
                } else {
                    collegeName = college;
                }
                info.setCollege(collegeName);
                String num = (String) getCellFormatValue(row.getCell(5));
                if (StringUtils.isNotBlank(num) && StringUtils.isNumeric(num)) {
                    total += Integer.valueOf(num);
                } else {
                    num = "0";
                }
                info.setProfession(professionName);
                info.setStudentNum(num);
                info.setSchoolId(tmp.getId());
                info.setSchoolName(schoolName);
                info.setType("1");
                bkInfo.add(info);
            }
            if (tmp != null) {
                tmp.setStudentNum(total + "");
                bkSchool.add(tmp);
            }
            log.info("本科信息：" + bkInfo.size());
            log.info("本科学校：" + bkSchool.size());

            List<EduInfo> zzInfo = new ArrayList<>();
            List<EduStation> zzSchool = new ArrayList<>();
            Sheet sheet3 = wb.getSheet("福建中职");
            tmp = null;
            school = "";
            college = "";
            total = 0;
            for (int rowNum = 2; rowNum <= sheet3.getLastRowNum(); rowNum++) {
                Row row = sheet3.getRow(rowNum);
                if (row == null) {
                    continue;
                }

                String schoolName = (String) getCellFormatValue(row.getCell(1));
                String professionName = (String) getCellFormatValue(row.getCell(3));
                if (StringUtils.isNotBlank(schoolName)) {
                    if (tmp != null) {
                        tmp.setStudentNum(total + "");
                        zzSchool.add(tmp);
                    }
                    if (StringUtils.isBlank(professionName)) {
                        continue;
                    }
                    total = 0;
                    school = schoolName;
                    tmp = new EduStation();
                    tmp.setId(UUIDGenerator.generate());
                    tmp.setSchoolName(schoolName);
                    tmp.setContactWay((String) getCellFormatValue(row.getCell(6)));
                    tmp.setCity((String) getCellFormatValue(row.getCell(2)));
                    tmp.setType("3");
                    tmp.setProvince("福建");
                } else {
                    schoolName = school;
                }
                EduInfo info = new EduInfo();
                info.setId(UUIDGenerator.generate());
//                String collegeName = (String) getCellFormatValue(row.getCell(3));
//                if (StringUtils.isNotBlank(collegeName)) {
//                    college = collegeName;
//                } else {
//                    collegeName = college;
//                }
//                info.setCollege(collegeName);
                String num = (String) getCellFormatValue(row.getCell(4));
                if (StringUtils.isNotBlank(num) && StringUtils.isNumeric(num)) {
                    total += Integer.valueOf(num);
                } else {
                    num = "0";
                }
                info.setProfession(professionName);
                info.setStudentNum(num);
                info.setSchoolId(tmp.getId());
                info.setSchoolName(schoolName);
                info.setType("3");
                zzInfo.add(info);
            }
            if (tmp != null) {
                tmp.setStudentNum(total + "");
                zzSchool.add(tmp);
            }
            log.info("中职信息：" + zzInfo.size());
            log.info("中职学校：" + zzSchool.size());

            List<EduInfo> gzInfo = new ArrayList<>();
            List<EduStation> gzSchool = new ArrayList<>();
            Sheet sheet4 = wb.getSheet("福建高职");
            tmp = null;
            school = "";
            college = "";
            total = 0;
            for (int rowNum = 2; rowNum <= sheet4.getLastRowNum(); rowNum++) {
                Row row = sheet4.getRow(rowNum);
                if (row == null) {
                    continue;
                }
                String schoolName = (String) getCellFormatValue(row.getCell(1));
                String professionName = (String) getCellFormatValue(row.getCell(4));
                if (StringUtils.isNotBlank(schoolName)) {
                    if (tmp != null) {
                        tmp.setStudentNum(total + "");
                        gzSchool.add(tmp);
                    }
                    if (StringUtils.isBlank(professionName)) {
                        continue;
                    }
                    total = 0;
                    school = schoolName;
                    tmp = new EduStation();
                    tmp.setId(UUIDGenerator.generate());
                    tmp.setSchoolName(schoolName);
                    tmp.setContactWay((String) getCellFormatValue(row.getCell(6)));
                    tmp.setCity((String) getCellFormatValue(row.getCell(2)));
                    tmp.setType("2");
                    tmp.setProvince("福建");
                } else {
                    schoolName = school;
                }
                EduInfo info = new EduInfo();
                info.setId(UUIDGenerator.generate());
                String collegeName = (String) getCellFormatValue(row.getCell(3));
                if (StringUtils.isNotBlank(collegeName)) {
                    college = collegeName;
                } else {
                    collegeName = college;
                }
                info.setCollege(collegeName);
                String num = (String) getCellFormatValue(row.getCell(5));
                if (StringUtils.isNotBlank(num) && StringUtils.isNumeric(num)) {
                    total += Integer.valueOf(num);
                } else {
                    num = "0";
                }
                info.setProfession(professionName);
                info.setStudentNum(num);
                info.setSchoolId(tmp.getId());
                info.setSchoolName(schoolName);
                info.setType("2");
                gzInfo.add(info);
            }
            if (tmp != null) {
                tmp.setStudentNum(total + "");
                gzSchool.add(tmp);
            }
            log.info("高职信息：" + gzInfo.size());
            log.info("高职学校：" + gzSchool.size());

            List<EduInfo> totalInfo = new ArrayList<>();
            List<EduStation> totalSchool = new ArrayList<>();
            totalInfo.addAll(qgInfo);
            totalInfo.addAll(bkInfo);
            totalInfo.addAll(zzInfo);
            totalInfo.addAll(gzInfo);
            log.info("合并信息：" + totalInfo.size());
            totalSchool.addAll(qgSchool);
            totalSchool.addAll(bkSchool);
            totalSchool.addAll(zzSchool);
            totalSchool.addAll(gzSchool);
            log.info("合并学校：" + totalSchool.size());
            eduInfoService.saveBatch(totalInfo);
            eduStationService.saveBatch(totalSchool);

            List<EduSummary> summaryList = new ArrayList<>();
            Sheet sheet5 = wb.getSheet("全国机械装备产业本科各省前三院校");
            int schoolNum = 0;
            int collegeNum = 0;
            int areaNum = 0;
            String schoolName = "";
            String province = "";
            String tmpCollege = "";
            for (int rowNum = 2; rowNum <= sheet5.getLastRowNum(); rowNum++) {
                Row row = sheet5.getRow(rowNum);
                if (row == null) {
                    continue;
                }
                String num1 = (String) getCellFormatValue(row.getCell(0));
                String num2 = (String) getCellFormatValue(row.getCell(6));
                String num3 = (String) getCellFormatValue(row.getCell(7));
                String provinceName = (String) getCellFormatValue(row.getCell(2));
                if (StringUtils.isNotBlank(provinceName)) {
                    school = provinceName;
                } else {
                    provinceName = school;
                }
                String tmpName = (String) getCellFormatValue(row.getCell(1));
                if (StringUtils.isNotBlank(tmpName)) {
                    schoolName = tmpName;
                } else {
                    tmpName = schoolName;
                }
                String collegeName = (String) getCellFormatValue(row.getCell(3));
                if (StringUtils.isNotBlank(provinceName)) {
                    tmpCollege = collegeName;
                } else {
                    collegeName = tmpCollege;
                }

                if (StringUtils.isNotBlank(num1)) {
                    schoolNum = Integer.valueOf(num1);
                }
                if (StringUtils.isNotBlank(num2)) {
                    collegeNum = Integer.valueOf(new BigDecimal(num2).setScale(0, BigDecimal.ROUND_HALF_DOWN).intValue());
                }
                if (StringUtils.isNotBlank(num3)) {
                    areaNum = Integer.valueOf(num3);
                }
                EduSummary eduSummary = new EduSummary();
                eduSummary.setId(UUIDGenerator.generate());
                eduSummary.setProvince(provinceName);
                eduSummary.setCollege(collegeName);
                eduSummary.setProfession((String) getCellFormatValue(row.getCell(4)));
                eduSummary.setStudentNum((String) getCellFormatValue(row.getCell(5)));
                eduSummary.setSchoolNum(schoolNum + "");
                eduSummary.setCollegeNum(collegeNum + "");
                eduSummary.setAreaNum(areaNum + "");
                eduSummary.setSchoolName(tmpName);
                summaryList.add(eduSummary);
            }
            log.info("前三：" + summaryList.size());
            eduSummaryService.saveBatch(summaryList);
        } catch (Exception e) {
            return Result.error(e.getMessage());
        }
        return Result.ok("导入成功");
    }



//    @ApiOperation("导入新版 0410  数字产业")
//    @GetMapping(value = "/import0410Shuzi")
    public Result<?> import0410Shuzi(){
        String filePath = "E:\\征信云\\hxrencai\\0409\\数字产业.xlsx";

        try {
            InputStream in = new FileInputStream(filePath);
            Workbook wb = new XSSFWorkbook(in);
            if (wb == null) {
                throw new JeecgBootException("文件不存在");
            }
            String school = "";
            String college = "";
            int total = 0;
            EduStation tmp = null;
            List<EduInfo> qgInfo = new ArrayList<>();
            List<EduStation> qgSchool = new ArrayList<>();
            Sheet sheet1 = wb.getSheet("数字产业全国本科");
            for (int rowNum = 1; rowNum <= sheet1.getLastRowNum(); rowNum++) {
                Row row = sheet1.getRow(rowNum);
                if (row == null) {
                    continue;
                }
                String schoolName = (String) getCellFormatValue(row.getCell(1));
                String professionName = (String) getCellFormatValue(row.getCell(4));
                if (StringUtils.isNotBlank(schoolName)) {
                    if (tmp != null) {
                        tmp.setStudentNum(total + "");
                        qgSchool.add(tmp);
                    }
                    if (StringUtils.isBlank(professionName)) {
                        continue;
                    }
                    total = 0;
                    school = schoolName;
                    tmp = new EduStation();
                    tmp.setId(UUIDGenerator.generate());
                    tmp.setSchoolName(schoolName);
                    tmp.setContactWay((String) getCellFormatValue(row.getCell(6)));
//                    tmp.setSchoolNature((String) getCellFormatValue(row.getCell(3)));
                    tmp.setProvince((String) getCellFormatValue(row.getCell(2)));
                    tmp.setMainType("2");
                    tmp.setType("1");
                } else {
                    schoolName = school;
                }
                EduInfo info = new EduInfo();
                info.setId(UUIDGenerator.generate());
                String collegeName = (String) getCellFormatValue(row.getCell(3));
                if (StringUtils.isNotBlank(collegeName)) {
                    college = collegeName;
                } else {
                    collegeName = college;
                }
                info.setCollege(collegeName);
                String num = (String) getCellFormatValue(row.getCell(5));
                if (StringUtils.isNotBlank(num) && StringUtils.isNumeric(num)) {
                    total += Integer.valueOf(num);
                } else {
                    num = "0";
                }
                info.setProfession(professionName);
                info.setStudentNum(num);
                info.setSchoolId(tmp.getId());
                info.setSchoolName(schoolName);
                info.setMainType("2");
                info.setType("1");
                qgInfo.add(info);

            }
            if (tmp != null) {
                tmp.setStudentNum(total + "");
                qgSchool.add(tmp);
            }
            log.info("全国本科信息：" + qgInfo.size());
            log.info("全国本科学校：" + qgSchool.size());


            List<EduInfo> bkInfo = new ArrayList<>();
            List<EduStation> bkSchool = new ArrayList<>();
            Sheet sheet2 = wb.getSheet("福建数字产业本科");
            tmp = null;
            school = "";
            college = "";
            total = 0;
            for (int rowNum = 1; rowNum <= sheet2.getLastRowNum(); rowNum++) {
                Row row = sheet2.getRow(rowNum);
                if (row == null) {
                    continue;
                }
                String schoolName = (String) getCellFormatValue(row.getCell(1));
                String professionName = (String) getCellFormatValue(row.getCell(3));
                if (StringUtils.isNotBlank(schoolName)) {
                    if (tmp != null) {
                        tmp.setStudentNum(total + "");
                        bkSchool.add(tmp);
                    }
                    if (StringUtils.isBlank(professionName)) {
                        continue;
                    }
                    total = 0;
                    school = schoolName;
                    tmp = new EduStation();
                    tmp.setId(UUIDGenerator.generate());
                    tmp.setSchoolName(schoolName);
                    tmp.setContactWay((String) getCellFormatValue(row.getCell(6)));
                    tmp.setCity((String) getCellFormatValue(row.getCell(5)));
                    tmp.setMainType("2");
                    tmp.setType("1");
                    tmp.setProvince("福建");
                } else {
                    schoolName = school;
                }
                EduInfo info = new EduInfo();
                info.setId(UUIDGenerator.generate());
                String collegeName = (String) getCellFormatValue(row.getCell(2));
                if (StringUtils.isNotBlank(collegeName)) {
                    college = collegeName;
                } else {
                    collegeName = college;
                }
                info.setCollege(collegeName);
                String num = (String) getCellFormatValue(row.getCell(4));
                if (StringUtils.isNotBlank(num) && StringUtils.isNumeric(num)) {
                    total += Integer.valueOf(num);
                } else {
                    num = "0";
                }
                info.setProfession(professionName);
                info.setStudentNum(num);
                info.setSchoolId(tmp.getId());
                info.setSchoolName(schoolName);
                info.setMainType("2");
                info.setType("1");
                bkInfo.add(info);
            }
            if (tmp != null) {
                tmp.setStudentNum(total + "");
                bkSchool.add(tmp);
            }
            log.info("福建本科信息：" + bkInfo.size());
            log.info("福建本科学校：" + bkSchool.size());

            List<EduInfo> zzInfo = new ArrayList<>();
            List<EduStation> zzSchool = new ArrayList<>();
            Sheet sheet3 = wb.getSheet("福建数字产业中职");
            tmp = null;
            school = "";
            college = "";
            total = 0;
            for (int rowNum = 1; rowNum <= sheet3.getLastRowNum(); rowNum++) {
                Row row = sheet3.getRow(rowNum);
                if (row == null) {
                    continue;
                }

                String schoolName = (String) getCellFormatValue(row.getCell(1));
                String professionName = (String) getCellFormatValue(row.getCell(2));
                if (StringUtils.isNotBlank(schoolName)) {
                    if (tmp != null) {
                        tmp.setStudentNum(total + "");
                        zzSchool.add(tmp);
                    }
                    if (StringUtils.isBlank(professionName)) {
                        continue;
                    }
                    total = 0;
                    school = schoolName;
                    tmp = new EduStation();
                    tmp.setId(UUIDGenerator.generate());
                    tmp.setSchoolName(schoolName);
                    tmp.setContactWay((String) getCellFormatValue(row.getCell(4)));
                    tmp.setCity((String) getCellFormatValue(row.getCell(3)));
                    tmp.setType("3");
                    tmp.setMainType("2");
                    tmp.setProvince("福建");
                } else {
                    schoolName = school;
                }
                EduInfo info = new EduInfo();
                info.setId(UUIDGenerator.generate());
//                String collegeName = (String) getCellFormatValue(row.getCell(3));
//                if (StringUtils.isNotBlank(collegeName)) {
//                    college = collegeName;
//                } else {
//                    collegeName = college;
//                }
//                info.setCollege(collegeName);
                String num = (String) getCellFormatValue(row.getCell(5));
                if (StringUtils.isNotBlank(num) && StringUtils.isNumeric(num)) {
                    total += Integer.valueOf(num);
                } else {
                    num = "0";
                }
                info.setProfession(professionName);
                info.setStudentNum(num);
                info.setSchoolId(tmp.getId());
                info.setSchoolName(schoolName);
                info.setMainType("2");
                info.setType("3");
                zzInfo.add(info);
            }
            if (tmp != null) {
                tmp.setStudentNum(total + "");
                zzSchool.add(tmp);
            }
            log.info("福建中职信息：" + zzInfo.size());
            log.info("福建中职学校：" + zzSchool.size());

            List<EduInfo> gzInfo = new ArrayList<>();
            List<EduStation> gzSchool = new ArrayList<>();
            Sheet sheet4 = wb.getSheet("福建数字产业高职");
            tmp = null;
            school = "";
            college = "";
            total = 0;
            for (int rowNum = 1; rowNum <= sheet4.getLastRowNum(); rowNum++) {
                Row row = sheet4.getRow(rowNum);
                if (row == null) {
                    continue;
                }
                String schoolName = (String) getCellFormatValue(row.getCell(1));
                String professionName = (String) getCellFormatValue(row.getCell(4));
                if (StringUtils.isNotBlank(schoolName)) {
                    if (tmp != null) {
                        tmp.setStudentNum(total + "");
                        gzSchool.add(tmp);
                    }
                    if (StringUtils.isBlank(professionName)) {
                        continue;
                    }
                    total = 0;
                    school = schoolName;
                    tmp = new EduStation();
                    tmp.setId(UUIDGenerator.generate());
                    tmp.setSchoolName(schoolName);
                    tmp.setContactWay((String) getCellFormatValue(row.getCell(6)));
                    tmp.setCity((String) getCellFormatValue(row.getCell(2)));
                    tmp.setMainType("2");
                    tmp.setType("2");
                    tmp.setProvince("福建");
                } else {
                    schoolName = school;
                }
                EduInfo info = new EduInfo();
                info.setId(UUIDGenerator.generate());
                String collegeName = (String) getCellFormatValue(row.getCell(3));
                if (StringUtils.isNotBlank(collegeName)) {
                    college = collegeName;
                } else {
                    collegeName = college;
                }
                info.setCollege(collegeName);
                String num = (String) getCellFormatValue(row.getCell(5));
                if (StringUtils.isNotBlank(num) && StringUtils.isNumeric(num)) {
                    total += Integer.valueOf(num);
                } else {
                    num = "0";
                }
                info.setProfession(professionName);
                info.setStudentNum(num);
                info.setSchoolId(tmp.getId());
                info.setSchoolName(schoolName);
                info.setMainType("2");
                info.setType("2");
                gzInfo.add(info);
            }
            if (tmp != null) {
                tmp.setStudentNum(total + "");
                gzSchool.add(tmp);
            }
            log.info("福建高职信息：" + gzInfo.size());
            log.info("福建高职学校：" + gzSchool.size());

            List<EduInfo> totalInfo = new ArrayList<>();
            List<EduStation> totalSchool = new ArrayList<>();
            totalInfo.addAll(qgInfo);
            totalInfo.addAll(bkInfo);
            totalInfo.addAll(zzInfo);
            totalInfo.addAll(gzInfo);
            log.info("合并信息：" + totalInfo.size());
            totalSchool.addAll(qgSchool);
            totalSchool.addAll(bkSchool);
            totalSchool.addAll(zzSchool);
            totalSchool.addAll(gzSchool);
            log.info("合并学校：" + totalSchool.size());
            eduInfoService.saveBatch(totalInfo);
            eduStationService.saveBatch(totalSchool);


            List<BasePark> baseParkList = new ArrayList<>();
            Sheet sheet5 = wb.getSheet("全国数字产业相关园区、基地名单");
            for (int rowNum = 1; rowNum <= sheet5.getLastRowNum(); rowNum++) {
                Row row = sheet5.getRow(rowNum);
                if (row == null) {
                    continue;
                }
                BasePark basePark = new BasePark();
                basePark.setId(UUIDGenerator.generate());
                basePark.setMainType("2");
                String parkName = (String) getCellFormatValue(row.getCell(1));
                if (StringUtils.isBlank(parkName)){
                    continue;
                }
                basePark.setParkName(parkName);
                String province =(String) getCellFormatValue(row.getCell(2));
                if (StringUtils.isNotBlank(province) && province.endsWith("省")) {
                    province = province.substring(0, province.length() - 1);
                }
                basePark.setProvince(province);
                String city =(String) getCellFormatValue(row.getCell(3));
                if (StringUtils.isNotBlank(city) &&  city.endsWith("市")) {
                    city = city.substring(0, city.length() - 1);
                }
                basePark.setCity(city);
                Hyperlink hyperlink = row.getCell(1).getHyperlink();
                if (hyperlink != null) {
                    basePark.setUrl(hyperlink.getAddress());
                }
                basePark.setType((String) getCellFormatValue(row.getCell(4)));
                baseParkList.add(basePark);
            }
            log.info("园区基地：" + baseParkList.size());
            baseParkService.saveBatch(baseParkList);

            List<Institute> instituteList = new ArrayList<>();
            Sheet sheet6 = wb.getSheet("全国数字产业相关研究院、国家重点实验室名单");
            for (int rowNum = 1; rowNum <= sheet6.getLastRowNum(); rowNum++) {
                Row row = sheet6.getRow(rowNum);
                if (row == null) {
                    continue;
                }
                Institute institute = new Institute();
                institute.setId(UUIDGenerator.generate());
                institute.setMainType("2");
                String instituteName = (String) getCellFormatValue(row.getCell(1));
                if (StringUtils.isBlank(instituteName)){
                    continue;
                }
                institute.setInstituteName(instituteName);
                institute.setType((String) getCellFormatValue(row.getCell(2)));
                institute.setProvince((String) getCellFormatValue(row.getCell(3)));
                instituteList.add(institute);
            }
            log.info("研究院：" + instituteList.size());
            instituteService.saveBatch(instituteList);
        } catch (Exception e) {
            return Result.error(e.getMessage());
        }
        return Result.ok("导入成功");
    }

//    @ApiOperation("导入新版 0410 文化旅游")
//    @GetMapping(value = "/import0410Wenhua")
    public Result<?> import0410Wenhua(){
        String filePath = "E:\\征信云\\hxrencai\\0409\\文化旅游产业.xlsx";

        try {
            InputStream in = new FileInputStream(filePath);
            Workbook wb = new XSSFWorkbook(in);
            if (wb == null) {
                throw new JeecgBootException("文件不存在");
            }
            String school = "";
            String college = "";
            int total = 0;
            EduStation tmp = null;
            List<EduInfo> qgInfo = new ArrayList<>();
            List<EduStation> qgSchool = new ArrayList<>();
            Sheet sheet1 = wb.getSheet("全国文化旅游本科");
            for (int rowNum = 2; rowNum <= sheet1.getLastRowNum(); rowNum++) {
                Row row = sheet1.getRow(rowNum);
                if (row == null) {
                    continue;
                }
                String schoolName = (String) getCellFormatValue(row.getCell(2));
                String professionName = (String) getCellFormatValue(row.getCell(4));
                String collegeName = (String) getCellFormatValue(row.getCell(3));
                if (StringUtils.isNotBlank(schoolName)) {
                    if (tmp != null) {
                        tmp.setStudentNum(total + "");
                        qgSchool.add(tmp);
                    }
                    if (StringUtils.isBlank(professionName)&&StringUtils.isBlank(collegeName)&&StringUtils.isBlank(schoolName)) {
                        continue;
                    }
                    total = 0;
                    school = schoolName;
                    tmp = new EduStation();
                    tmp.setId(UUIDGenerator.generate());
                    tmp.setSchoolName(schoolName);
                    tmp.setContactWay((String) getCellFormatValue(row.getCell(6)));
//                    tmp.setSchoolNature((String) getCellFormatValue(row.getCell(3)));
                    tmp.setProvince((String) getCellFormatValue(row.getCell(1)));
                    tmp.setMainType("3");
                    tmp.setType("1");
                } else {
                    schoolName = school;
                }
                EduInfo info = new EduInfo();
                info.setId(UUIDGenerator.generate());

                if (StringUtils.isNotBlank(collegeName)) {
                    college = collegeName;
                } else {
                    collegeName = college;
                }
                info.setCollege(collegeName);
                String num = (String) getCellFormatValue(row.getCell(5));
                if (StringUtils.isNotBlank(num) && StringUtils.isNumeric(num)) {
                    total += Integer.valueOf(num);
                } else {
                    num = "0";
                }
                info.setProfession(professionName);
                info.setStudentNum(num);
                info.setSchoolId(tmp.getId());
                info.setSchoolName(schoolName);
                info.setMainType("3");
                info.setType("1");
                qgInfo.add(info);
            }
            if (tmp != null) {
                tmp.setStudentNum(total + "");
                qgSchool.add(tmp);
            }
            log.info("全国本科信息：" + qgInfo.size());
            log.info("全国本科学校：" + qgSchool.size());



            List<EduInfo> bkInfo = new ArrayList<>();
            List<EduStation> bkSchool = new ArrayList<>();
            Sheet sheet2 = wb.getSheet("福建文化旅游本科");
            tmp = null;
            school = "";
            college = "";
            total = 0;
            for (int rowNum = 2; rowNum <= sheet2.getLastRowNum(); rowNum++) {
                Row row = sheet2.getRow(rowNum);
                if (row == null) {
                    continue;
                }
                String schoolName = (String) getCellFormatValue(row.getCell(1));
                String professionName = (String) getCellFormatValue(row.getCell(4));
                if (StringUtils.isNotBlank(schoolName)) {
                    if (tmp != null) {
                        tmp.setStudentNum(total + "");
                        bkSchool.add(tmp);
                    }
                    if (StringUtils.isBlank(professionName)) {
                        continue;
                    }
                    total = 0;
                    school = schoolName;
                    tmp = new EduStation();
                    tmp.setId(UUIDGenerator.generate());
                    tmp.setSchoolName(schoolName);
                    tmp.setContactWay((String) getCellFormatValue(row.getCell(6)));
                    tmp.setCity((String) getCellFormatValue(row.getCell(2)));
                    tmp.setMainType("3");
                    tmp.setType("1");
                    tmp.setProvince("福建");
                } else {
                    schoolName = school;
                }
                EduInfo info = new EduInfo();
                info.setId(UUIDGenerator.generate());
                String collegeName = (String) getCellFormatValue(row.getCell(3));
                if (StringUtils.isNotBlank(collegeName)) {
                    college = collegeName;
                } else {
                    collegeName = college;
                }
                info.setCollege(collegeName);
                String num = (String) getCellFormatValue(row.getCell(5));
                if (StringUtils.isNotBlank(num) && StringUtils.isNumeric(num)) {
                    total += Integer.valueOf(num);
                } else {
                    num = "0";
                }
                info.setProfession(professionName);
                info.setStudentNum(num);
                info.setSchoolId(tmp.getId());
                info.setSchoolName(schoolName);
                info.setMainType("3");
                info.setType("1");
                bkInfo.add(info);
            }
            if (tmp != null) {
                tmp.setStudentNum(total + "");
                bkSchool.add(tmp);
            }
            log.info("福建本科信息：" + bkInfo.size());
            log.info("福建本科学校：" + bkSchool.size());

            List<EduInfo> zzInfo = new ArrayList<>();
            List<EduStation> zzSchool = new ArrayList<>();
            Sheet sheet3 = wb.getSheet("福建文化旅游中职");
            tmp = null;
            school = "";
            college = "";
            total = 0;
            for (int rowNum = 2; rowNum <= sheet3.getLastRowNum(); rowNum++) {
                Row row = sheet3.getRow(rowNum);
                if (row == null) {
                    continue;
                }
                String schoolName = (String) getCellFormatValue(row.getCell(1));
                String professionName = (String) getCellFormatValue(row.getCell(3));
                if (StringUtils.isNotBlank(schoolName)) {
                    if (tmp != null) {
                        tmp.setStudentNum(total + "");
                        zzSchool.add(tmp);
                    }
                    if (StringUtils.isBlank(professionName)) {
                        continue;
                    }
                    total = 0;
                    school = schoolName;
                    tmp = new EduStation();
                    tmp.setId(UUIDGenerator.generate());
                    tmp.setSchoolName(schoolName);
                    tmp.setContactWay((String) getCellFormatValue(row.getCell(5)));
                    tmp.setCity((String) getCellFormatValue(row.getCell(2)));
                    tmp.setType("3");
                    tmp.setMainType("3");
                    tmp.setProvince("福建");
                } else {
                    schoolName = school;
                }
                EduInfo info = new EduInfo();
                info.setId(UUIDGenerator.generate());
//                String collegeName = (String) getCellFormatValue(row.getCell(3));
//                if (StringUtils.isNotBlank(collegeName)) {
//                    college = collegeName;
//                } else {
//                    collegeName = college;
//                }
//                info.setCollege(collegeName);
                String num = (String) getCellFormatValue(row.getCell(4));
                if (StringUtils.isNotBlank(num) && StringUtils.isNumeric(num)) {
                    total += Integer.valueOf(num);
                } else {
                    num = "0";
                }
                info.setProfession(professionName);
                info.setStudentNum(num);
                info.setSchoolId(tmp.getId());
                info.setSchoolName(schoolName);
                info.setMainType("3");
                info.setType("3");
                zzInfo.add(info);
            }
            if (tmp != null) {
                tmp.setStudentNum(total + "");
                zzSchool.add(tmp);
            }
            log.info("福建中职信息：" + zzInfo.size());
            log.info("福建中职学校：" + zzSchool.size());

            List<EduInfo> gzInfo = new ArrayList<>();
            List<EduStation> gzSchool = new ArrayList<>();
            Sheet sheet4 = wb.getSheet("福建文化旅游高职");
            tmp = null;
            school = "";
            college = "";
            total = 0;
            for (int rowNum = 2; rowNum <= sheet4.getLastRowNum(); rowNum++) {
                Row row = sheet4.getRow(rowNum);
                if (row == null) {
                    continue;
                }
                String schoolName = (String) getCellFormatValue(row.getCell(1));
                String professionName = (String) getCellFormatValue(row.getCell(3));
                if (StringUtils.isNotBlank(schoolName)) {
                    if (tmp != null) {
                        tmp.setStudentNum(total + "");
                        gzSchool.add(tmp);
                    }
                    if (StringUtils.isBlank(professionName)) {
                        continue;
                    }
                    total = 0;
                    school = schoolName;
                    tmp = new EduStation();
                    tmp.setId(UUIDGenerator.generate());
                    tmp.setSchoolName(schoolName);
                    tmp.setContactWay((String) getCellFormatValue(row.getCell(5)));
                    tmp.setCity((String) getCellFormatValue(row.getCell(2)));
                    tmp.setMainType("3");
                    tmp.setType("2");
                    tmp.setProvince("福建");
                } else {
                    schoolName = school;
                }
                EduInfo info = new EduInfo();
                info.setId(UUIDGenerator.generate());
//                String collegeName = (String) getCellFormatValue(row.getCell(3));
//                if (StringUtils.isNotBlank(collegeName)) {
//                    college = collegeName;
//                } else {
//                    collegeName = college;
//                }
//                info.setCollege(collegeName);
                String num = (String) getCellFormatValue(row.getCell(4));
                if (StringUtils.isNotBlank(num) && StringUtils.isNumeric(num)) {
                    total += Integer.valueOf(num);
                } else {
                    num = "0";
                }
                info.setProfession(professionName);
                info.setStudentNum(num);
                info.setSchoolId(tmp.getId());
                info.setSchoolName(schoolName);
                info.setMainType("3");
                info.setType("2");
                gzInfo.add(info);
            }
            if (tmp != null) {
                tmp.setStudentNum(total + "");
                gzSchool.add(tmp);
            }
            log.info("福建高职信息：" + gzInfo.size());
            log.info("福建高职学校：" + gzSchool.size());

            List<EduInfo> totalInfo = new ArrayList<>();
            List<EduStation> totalSchool = new ArrayList<>();
            totalInfo.addAll(qgInfo);
            totalInfo.addAll(bkInfo);
            totalInfo.addAll(zzInfo);
            totalInfo.addAll(gzInfo);
            log.info("合并信息：" + totalInfo.size());
            totalSchool.addAll(qgSchool);
            totalSchool.addAll(bkSchool);
            totalSchool.addAll(zzSchool);
            totalSchool.addAll(gzSchool);
            log.info("合并学校：" + totalSchool.size());
            eduInfoService.saveBatch(totalInfo);
            eduStationService.saveBatch(totalSchool);


            List<Institute> instituteList = new ArrayList<>();
            Sheet sheet5 = wb.getSheet("全国文化旅游研究院");
            for (int rowNum = 2; rowNum <= sheet5.getLastRowNum(); rowNum++) {
                Row row = sheet5.getRow(rowNum);
                if (row == null) {
                    continue;
                }
                Institute institute = new Institute();
                institute.setId(UUIDGenerator.generate());
                institute.setMainType("3");
                String instituteName = (String) getCellFormatValue(row.getCell(2));
                if (StringUtils.isBlank(instituteName)){
                    continue;
                }
                institute.setInstituteName(instituteName);
//                institute.setType((String) getCellFormatValue(row.getCell(2)));
                institute.setProvince((String) getCellFormatValue(row.getCell(1)));
                instituteList.add(institute);
            }
            log.info("研究院：" + instituteList.size());
            instituteService.saveBatch(instituteList);
        } catch (Exception e) {
            return Result.error(e.getMessage());
        }
        return Result.ok("导入成功");
    }

//    @ApiOperation("导入新版 0413 氟化工")
//    @GetMapping(value = "/import0413HuHua")
    public Result<?> import0412HuHua(){
        String filePath1 = "E:\\征信云\\hxrencai\\0412\\氟化工产业\\福建中职.xlsx";
        String filePath2 = "E:\\征信云\\hxrencai\\0412\\氟化工产业\\全国本科.xlsx";
        String filePath3 = "E:\\征信云\\hxrencai\\0412\\氟化工产业\\全国专科.xlsx";
        String filePath4 = "E:\\征信云\\hxrencai\\0412\\氟化工产业\\研究院.xlsx";
        String filePath5 = "E:\\征信云\\hxrencai\\0412\\氟化工产业\\园区.xlsx";

        try {
            InputStream fjzzin = new FileInputStream(filePath1);
            Workbook fjzzwb = new XSSFWorkbook(fjzzin);
            if (fjzzwb == null) {
                throw new JeecgBootException("文件不存在");
            }

            String school = "";
            String college = "";
            int total = 0;
            EduStation tmp = null;
            List<EduInfo> fjzzInfo = new ArrayList<>();
            List<EduStation> fjzzSchool = new ArrayList<>();
            Sheet sheet1 = fjzzwb.getSheetAt(0);
            for (int rowNum = 2; rowNum <= sheet1.getLastRowNum(); rowNum++) {
                Row row = sheet1.getRow(rowNum);
                if (row == null) {
                    continue;
                }
                String schoolName = (String) getCellFormatValue(row.getCell(1));
                String professionName = (String) getCellFormatValue(row.getCell(2));
                if (StringUtils.isNotBlank(schoolName)) {
                    if (tmp != null) {
                        tmp.setStudentNum(total + "");
                        fjzzSchool.add(tmp);
                    }
                    if (StringUtils.isBlank(professionName)) {
                        continue;
                    }
                    total = 0;
                    school = schoolName;
                    tmp = new EduStation();
                    tmp.setId(UUIDGenerator.generate());
                    tmp.setSchoolName(schoolName);
//                    tmp.setContactWay((String) getCellFormatValue(row.getCell(6)));
//                    tmp.setSchoolNature((String) getCellFormatValue(row.getCell(3)));
                    tmp.setCity((String) getCellFormatValue(row.getCell(3)));
                    tmp.setProvince("福建");
                    tmp.setMainType("4");
                    tmp.setType("3");
                } else {
                    schoolName = school;
                }
                EduInfo info = new EduInfo();
                info.setId(UUIDGenerator.generate());
//                String collegeName = (String) getCellFormatValue(row.getCell(3));
//                if (StringUtils.isNotBlank(collegeName)) {
//                    college = collegeName;
//                } else {
//                    collegeName = college;
//                }
//                info.setCollege(collegeName);
                String num = (String) getCellFormatValue(row.getCell(5));
                if (StringUtils.isNotBlank(num) && StringUtils.isNumeric(num)) {
                    total += Integer.valueOf(num);
                } else {
                    num = "0";
                }
                info.setProfession(professionName);
                info.setStudentNum(num);
                info.setSchoolId(tmp.getId());
                info.setSchoolName(schoolName);
                info.setMainType("4");
                info.setType("3");
                fjzzInfo.add(info);
            }
            if (tmp != null) {
                tmp.setStudentNum(total + "");
                fjzzSchool.add(tmp);
            }
            log.info("福建中职信息：" + fjzzInfo.size());
            log.info("福建中职学校：" + fjzzSchool.size());


            InputStream qgbkin = new FileInputStream(filePath2);
            Workbook qgbkwb = new XSSFWorkbook(qgbkin);
            if (qgbkwb == null) {
                throw new JeecgBootException("文件不存在");
            }
            school = "";
            college = "";
            total = 0;
            tmp = null;
            List<EduInfo> qgInfo = new ArrayList<>();
            List<EduStation> qgSchool = new ArrayList<>();
            Sheet sheet2 = qgbkwb.getSheetAt(0);
            for (int rowNum = 2; rowNum <= sheet2.getLastRowNum(); rowNum++) {
                Row row = sheet2.getRow(rowNum);
                if (row == null) {
                    continue;
                }
                String schoolName = (String) getCellFormatValue(row.getCell(1));
                String professionName = (String) getCellFormatValue(row.getCell(4));
                if (StringUtils.isNotBlank(schoolName)) {
                    if (tmp != null) {
                        tmp.setStudentNum(total + "");
                        qgSchool.add(tmp);
                    }
                    if (StringUtils.isBlank(professionName)) {
                        continue;
                    }
                    total = 0;
                    school = schoolName;
                    tmp = new EduStation();
                    tmp.setId(UUIDGenerator.generate());
                    tmp.setSchoolName(schoolName);
//                    tmp.setContactWay((String) getCellFormatValue(row.getCell(6)));
//                    tmp.setSchoolNature((String) getCellFormatValue(row.getCell(3)));
                    tmp.setProvince((String) getCellFormatValue(row.getCell(2)));
                    tmp.setMainType("4");
                    tmp.setType("1");
                } else {
                    schoolName = school;
                }
                EduInfo info = new EduInfo();
                info.setId(UUIDGenerator.generate());
                String collegeName = (String) getCellFormatValue(row.getCell(3));
                if (StringUtils.isNotBlank(collegeName)) {
                    college = collegeName;
                } else {
                    collegeName = college;
                }
                info.setCollege(collegeName);
                String num = (String) getCellFormatValue(row.getCell(5));
                if (StringUtils.isNotBlank(num) && StringUtils.isNumeric(num)) {
                    total += Integer.valueOf(num);
                } else {
                    num = "0";
                }
                info.setProfession(professionName);
                info.setStudentNum(num);
                info.setSchoolId(tmp.getId());
                info.setSchoolName(schoolName);
                info.setMainType("4");
                info.setType("1");
                qgInfo.add(info);
            }
            if (tmp != null) {
                tmp.setStudentNum(total + "");
                qgSchool.add(tmp);
            }
            log.info("全国本科信息：" + qgInfo.size());
            log.info("全国本科学校：" + qgSchool.size());



            InputStream yjyin = new FileInputStream(filePath4);
            Workbook yjywb = new XSSFWorkbook(yjyin);
            List<Institute> instituteList = new ArrayList<>();
            if (yjywb == null) {
                throw new JeecgBootException("文件不存在");
            }
            Sheet sheet3 = yjywb.getSheetAt(0);
            for (int rowNum = 2; rowNum <= sheet3.getLastRowNum(); rowNum++) {
                Row row = sheet3.getRow(rowNum);
                if (row == null) {
                    continue;
                }
                Institute institute = new Institute();
                institute.setId(UUIDGenerator.generate());
                String instituteName = (String) getCellFormatValue(row.getCell(1));
                if (StringUtils.isBlank(instituteName)){
                    continue;
                }
                institute.setInstituteName(instituteName);
                institute.setProvince((String) getCellFormatValue(row.getCell(2)));
                institute.setType((String) getCellFormatValue(row.getCell(4)));
                institute.setMainType("4");
                instituteList.add(institute);
            }
            log.info("研究院：" + instituteList.size());


            InputStream yqin = new FileInputStream(filePath5);
            Workbook yqwb = new XSSFWorkbook(yqin);
            List<BasePark> baseParkList = new ArrayList<>();
            if (yjywb == null) {
                throw new JeecgBootException("文件不存在");
            }
            Sheet sheet4 = yqwb.getSheetAt(0);
            for (int rowNum = 2; rowNum <= sheet4.getLastRowNum(); rowNum++) {
                Row row = sheet4.getRow(rowNum);
                if (row == null) {
                    continue;
                }
                BasePark park = new BasePark();
                park.setId(UUIDGenerator.generate());
                String parkName = (String) getCellFormatValue(row.getCell(1));
                if (StringUtils.isBlank(parkName)){
                    continue;
                }
                park.setParkName(parkName);
                park.setProvince((String) getCellFormatValue(row.getCell(3)));
                park.setFeatures((String) getCellFormatValue(row.getCell(2)));
                park.setMainType("4");
                baseParkList.add(park);
            }
            log.info("园区：" + baseParkList.size());


            InputStream qgzkin = new FileInputStream(filePath3);
            Workbook qgzkwb = new XSSFWorkbook(qgzkin);
            List<EduInfo> qgzkInfo = new ArrayList<>();

            List<EduInfo> qgzkNotInfo = new ArrayList<>();
            List<EduStation> qgzkSchool = new ArrayList<>();
            if (yjywb == null) {
                throw new JeecgBootException("文件不存在");
            }
            //总表
            Sheet sheet5 = qgzkwb.getSheet("总表");
            for (int rowNum = 1; rowNum <= sheet5.getLastRowNum(); rowNum++) {
                Row row = sheet5.getRow(rowNum);
                if (row == null) {
                    continue;
                }
                EduStation station = new EduStation();
                station.setId(UUIDGenerator.generate());
                String schoolName = (String) getCellFormatValue(row.getCell(1));
                if (StringUtils.isBlank(schoolName)){
                    continue;
                }
                station.setSchoolName(schoolName);
                station.setProvince((String) getCellFormatValue(row.getCell(2)));
                station.setStudentNum("0");
                station.setMainType("4");
                station.setType("2");
                qgzkSchool.add(station);
            }
            log.info("全国专科：" + qgzkSchool.size());
            String[] sheetArrays = new String[]{"化工生物技术专业","药品生物技术专业","高分子材料加工技术专业","应用化工技术专业",
                    "石油化工技术专业","高分子合成技术专业","精细化工技术专业","工业分析技术专业",
                    "化工装备技术专业","化工自动化技术专业","涂装防护技术专业","高分子材料工程技术专业",
                    "材料工程技术专业","环境工程技术专业","清洁生产与减排技术专业","化工安全技术专业"};
            for(String sheetName:sheetArrays){
                Sheet sheet = qgzkwb.getSheet(sheetName);
                for (int rowNum = 1; rowNum <= sheet.getLastRowNum(); rowNum++) {
                    Row row = sheet.getRow(rowNum);
                    if (row == null) {
                        continue;
                    }
                    String schoolName = (String) getCellFormatValue(row.getCell(1));
                    String province = (String) getCellFormatValue(row.getCell(2));
                    if (StringUtils.isBlank(schoolName)){
                        continue;
                    }
                    String schoolId = "";
                    for (EduStation station:qgzkSchool){
                        if (station.getSchoolName().equals(schoolName)&&  station.getProvince().equals(province)){
                            schoolId = station.getId();
                        }
                    }
                    if (StringUtils.isBlank(schoolId)){
                        schoolId = UUIDGenerator.generate();
                        EduStation station = new EduStation();
                        station.setId(schoolId);
                        station.setSchoolName(schoolName);
                        station.setProvince(province);
                        station.setStudentNum("0");
                        station.setMainType("4");
                        station.setType("2");
                        qgzkSchool.add(station);
                    }
                    EduInfo info = new EduInfo();
                    info.setId(UUIDGenerator.generate());
                    info.setSchoolId(schoolId);
                    info.setSchoolName(schoolName);
                    info.setMainType("4");
                    info.setType("2");
                    info.setProfession(sheetName);
                    info.setStudentNum("0");
                    if (StringUtils.isNotBlank(schoolId)){
                        qgzkInfo.add(info);
                    } else {
                        qgzkNotInfo.add(info);
                    }
                }
            }
            log.info("全国专科：" + qgzkSchool.size());
            log.info("全国专科院校信息：" + qgzkInfo.size());
            log.info("全国专科院校信息(失败)：" + qgzkNotInfo.size());





            List<EduInfo> infoTotal = new ArrayList<>();
            List<EduStation> schoolTotal = new ArrayList<>();
            //合并
            schoolTotal.addAll(fjzzSchool);
            infoTotal.addAll(fjzzInfo);
            schoolTotal.addAll(qgSchool);
            infoTotal.addAll(qgInfo);
            schoolTotal.addAll(qgzkSchool);
            infoTotal.addAll(qgzkInfo);

            log.info("全国 共计：" + schoolTotal.size());
            log.info("全国 共计：" + infoTotal.size());
            //保存
            instituteService.saveBatch(instituteList);
            baseParkService.saveBatch(baseParkList);
            eduStationService.saveBatch(schoolTotal);
            eduInfoService.saveBatch(infoTotal);
        } catch (Exception e){
            return Result.error(e.getMessage());
        }
        return Result.ok("导入成功");
    }


//    @ApiOperation("导入新版 0507 氟化工 ")
//    @GetMapping(value = "/import0507HuHua")
    public Result<?> import0507HuHua(){
        String filePath = "E:\\征信云\\hxrencai\\0507\\福建省化工相关专业院校（本科）4.20(1).xls";

        try {
            InputStream is = new FileInputStream(filePath);
            HSSFWorkbook hssfWorkbook = new HSSFWorkbook(is);
            HSSFSheet hssfSheet = hssfWorkbook.getSheetAt(0);
            String school = "";
            String college = "";
            int total = 0;
            EduStation tmp = null;
            List<EduInfo> fjbkInfo = new ArrayList<>();
            List<EduStation> fjbkSchool = new ArrayList<>();
            for (int rowNum = 2; rowNum <= hssfSheet.getLastRowNum(); rowNum++) {
                HSSFRow hssfRow = hssfSheet.getRow(rowNum);
                if (hssfRow == null) {
                    continue;
                }
                String schoolName = getValue(hssfRow.getCell(2));
                String professionName = getValue(hssfRow.getCell(5));
                if (StringUtils.isNotBlank(schoolName)) {
                    if (tmp != null) {
                        tmp.setStudentNum(total + "");
                        fjbkSchool.add(tmp);
                    }
                    if (StringUtils.isBlank(professionName)) {
                        continue;
                    }
                    total = 0;
                    school = schoolName;
                    tmp = new EduStation();
                    tmp.setId(UUIDGenerator.generate());
                    tmp.setSchoolName(schoolName);
                    tmp.setProvince("福建");
                    tmp.setContactWay( getValue(hssfRow.getCell(3)));
                    tmp.setCity(getValue(hssfRow.getCell(1)));
                    tmp.setMainType("4");
                    tmp.setType("1");
                } else {
                    schoolName = school;
                }
                EduInfo info = new EduInfo();
                info.setId(UUIDGenerator.generate());
                String collegeName =  getValue(hssfRow.getCell(4));
                if (StringUtils.isNotBlank(collegeName)) {
                    college = collegeName;
                } else {
                    collegeName = college;
                }
                info.setCollege(collegeName);
                String num =  getValue(hssfRow.getCell(6));
                if (StringUtils.isNotBlank(num) && StringUtils.isNumeric(num)) {
                    total += Integer.valueOf(num);
                } else {
                    num = "0";
                }
                info.setProfession(professionName);
                info.setStudentNum(num);
                info.setSchoolId(tmp.getId());
                info.setSchoolName(schoolName);
                info.setMainType("4");
                info.setType("1");
                fjbkInfo.add(info);
            }
            if (tmp != null) {
                tmp.setStudentNum(total + "");
                fjbkSchool.add(tmp);
            }
            log.info("福建 共计：" + fjbkSchool.size());
            log.info("福建 共计：" + fjbkInfo.size());
            eduStationService.saveBatch(fjbkSchool);
            eduInfoService.saveBatch(fjbkInfo);
        } catch (Exception e) {
            e.printStackTrace();

        }

        return Result.ok("导入成功");
    }


//    @ApiOperation("氟化工 0507 删除福建高职")
//    @GetMapping(value = "/deleteHuagongFjgz")
    public Result<?> deleteHuagongFjgz(){
        List<EduStation> eduList = eduStationService.list(new LambdaQueryWrapper<EduStation>()
                .eq(EduStation::getMainType,"4").eq(EduStation::getType,"2").eq(EduStation::getProvince,"福建"));
        List<String> ids = eduList.stream().map(EduStation::getId).collect(Collectors.toList());
        List<EduInfo> infoList = eduInfoService.list(new LambdaQueryWrapper<EduInfo>().eq(EduInfo::getMainType,"4")
                .eq(EduInfo::getType,"2").in(EduInfo::getSchoolId,ids));
        List<String> ids2 = infoList.stream().map(EduInfo::getId).collect(Collectors.toList());

        eduStationService.removeByIds(ids);
        eduInfoService.removeByIds(ids2);

        return Result.ok("删除成功");
    }



//    @ApiOperation("氟化工 0507 导入福建高职")
//    @GetMapping(value = "/import0507HuagongFjgz")
    public Result<?> import0507HuagongFjgz(){
        String filePath = "E:\\征信云\\hxrencai\\0507\\附件6：福建省化工相关专业院校（高职）(1).xls";

        try {
            InputStream is = new FileInputStream(filePath);
            HSSFWorkbook hssfWorkbook = new HSSFWorkbook(is);
            HSSFSheet hssfSheet = hssfWorkbook.getSheetAt(0);
            String school = "";
            String college = "";
            int total = 0;
            EduStation tmp = null;
            List<EduInfo> fjbkInfo = new ArrayList<>();
            List<EduStation> fjbkSchool = new ArrayList<>();
            for (int rowNum = 2; rowNum <= hssfSheet.getLastRowNum(); rowNum++) {
                HSSFRow hssfRow = hssfSheet.getRow(rowNum);
                if (hssfRow == null) {
                    continue;
                }
                String schoolName = getValue(hssfRow.getCell(2));
                String professionName = getValue(hssfRow.getCell(3));
                if (StringUtils.isNotBlank(schoolName)) {
                    if (tmp != null) {
                        tmp.setStudentNum(total + "");
                        fjbkSchool.add(tmp);
                    }
                    if (StringUtils.isBlank(professionName)) {
                        continue;
                    }
                    total = 0;
                    school = schoolName;
                    tmp = new EduStation();
                    tmp.setId(UUIDGenerator.generate());
                    tmp.setSchoolName(schoolName);
                    tmp.setProvince("福建");
//                    tmp.setContactWay( getValue(hssfRow.getCell(3)));
                    tmp.setCity(getValue(hssfRow.getCell(1)));
                    tmp.setMainType("4");
                    tmp.setType("2");
                } else {
                    schoolName = school;
                }
                EduInfo info = new EduInfo();
                info.setId(UUIDGenerator.generate());
//                String collegeName =  getValue(hssfRow.getCell(4));
//                if (StringUtils.isNotBlank(collegeName)) {
//                    college = collegeName;
//                } else {
//                    collegeName = college;
//                }
//                info.setCollege(collegeName);
                String num =  getValue(hssfRow.getCell(4));
                if (StringUtils.isNotBlank(num) && StringUtils.isNumeric(num)) {
                    total += Integer.valueOf(num);
                } else {
                    num = "0";
                }
                info.setProfession(professionName);
                info.setStudentNum(num);
                info.setSchoolId(tmp.getId());
                info.setSchoolName(schoolName);
                info.setMainType("4");
                info.setType("2");
                fjbkInfo.add(info);
            }
            if (tmp != null) {
                tmp.setStudentNum(total + "");
                fjbkSchool.add(tmp);
            }
            log.info("福建 共计：" + fjbkSchool.size());
            log.info("福建 共计：" + fjbkInfo.size());
            eduStationService.saveBatch(fjbkSchool);
            eduInfoService.saveBatch(fjbkInfo);
        } catch (Exception e) {
            e.printStackTrace();

        }

        return Result.ok("导入成功");
    }


//    @ApiOperation("导入新版 0420 导入新数据")
//    @GetMapping(value = "/import0420Data")
    public Result<?> import0420Data(){
        String filePath = "E:\\征信云\\hxrencai\\0420\\副本全国机械装备产业相关专业本科院校及宁夏周边五省本科院校（560所）4.20.xlsx";
        try {
            InputStream in = new FileInputStream(filePath);
            Workbook wb = new XSSFWorkbook(in);
            if (wb == null) {
                throw new JeecgBootException("文件不存在");
            }
            String school = "";
            String college = "";
            int total = 0;
            EduStation tmp = null;
            List<EduInfo> qgInfo = new ArrayList<>();
            List<EduStation> qgSchool = new ArrayList<>();
            Sheet sheet1 = wb.getSheet("宁夏周边五省本科院校");
            for (int rowNum = 2; rowNum <= sheet1.getLastRowNum(); rowNum++) {
                Row row = sheet1.getRow(rowNum);
                if (row == null) {
                    continue;
                }
                String schoolName = (String) getCellFormatValue(row.getCell(1));
                String professionName = (String) getCellFormatValue(row.getCell(4));
                if (StringUtils.isNotBlank(schoolName)) {
                    if (tmp != null) {
                        tmp.setStudentNum(total + "");
                        qgSchool.add(tmp);
                    }
                    if (StringUtils.isBlank(professionName)) {
                        continue;
                    }
                    total = 0;
                    school = schoolName;
                    tmp = new EduStation();
                    tmp.setId(UUIDGenerator.generate());
                    tmp.setSchoolName(schoolName);
                    tmp.setContactWay((String) getCellFormatValue(row.getCell(7)));
//                    tmp.setSchoolNature((String) getCellFormatValue(row.getCell(3)));
                    tmp.setProvince((String) getCellFormatValue(row.getCell(2)));
                    tmp.setMainType("1");
                    tmp.setType("1");
                } else {
                    schoolName = school;
                }
                EduInfo info = new EduInfo();
                info.setId(UUIDGenerator.generate());
                String collegeName = (String) getCellFormatValue(row.getCell(3));
                if (StringUtils.isNotBlank(collegeName)) {
                    college = collegeName;
                } else {
                    collegeName = college;
                }
                info.setCollege(collegeName);
                String num = (String) getCellFormatValue(row.getCell(5));
                if (StringUtils.isNotBlank(num) && StringUtils.isNumeric(num)) {
                    total += Integer.valueOf(num);
                } else {
                    num = "0";
                }
                info.setProfession(professionName);
                info.setStudentNum(num);
                info.setSchoolId(tmp.getId());
                info.setSchoolName(schoolName);
                info.setMainType("1");
                info.setType("1");
                qgInfo.add(info);
            }
            if (tmp != null) {
                tmp.setStudentNum(total + "");
                qgSchool.add(tmp);
            }
            log.info("全国本科学校 宁夏：" + qgSchool.size());
            log.info("全国本科信息 宁夏：" + qgInfo.size());


            List<EduInfo> qgInfoSelect = new ArrayList<>();
            List<EduStation> qgSchoolSelect = new ArrayList<>();
            for (EduStation station:qgSchool){
                EduStation old = eduStationService.getOne(new LambdaQueryWrapper<EduStation>()
                        .eq(EduStation::getMainType,"1")
                        .eq(EduStation::getType,"1")
                        .eq(EduStation::getSchoolName,station.getSchoolName()));
                if (ObjectUtil.isNotEmpty(old)){
                    continue;
                }
                qgSchoolSelect.add(station);
                for (EduInfo info:qgInfo){
                    if (!info.getSchoolId().equals(station.getId())){
                        continue;
                    }
                    qgInfoSelect.add(info);
                }
            }

            log.info("全国本科学校 宁夏(筛选)：" + qgSchoolSelect.size());
            log.info("全国本科信息 宁夏(筛选)：" + qgInfoSelect.size());
            eduStationService.saveBatch(qgSchoolSelect);
            eduInfoService.saveBatch(qgInfoSelect);


            school = "";
            college = "";
            total = 0;
            tmp = null;
            List<EduInfo> qgbkInfo = new ArrayList<>();
            List<EduStation> qgbkSchool = new ArrayList<>();
            Sheet sheet2 = wb.getSheet("全国本科院校（联系方式）");
            for (int rowNum = 2; rowNum <= sheet2.getLastRowNum(); rowNum++) {
                Row row = sheet2.getRow(rowNum);
                if (row == null) {
                    continue;
                }
                String schoolName = (String) getCellFormatValue(row.getCell(0));
                String professionName = (String) getCellFormatValue(row.getCell(4));
                if (StringUtils.isNotBlank(schoolName)) {
                    if (tmp != null) {
                        tmp.setStudentNum(total + "");
                        qgbkSchool.add(tmp);
                    }
                    if (StringUtils.isBlank(professionName)) {
                        continue;
                    }
                    total = 0;
                    school = schoolName;
                    tmp = new EduStation();
                    tmp.setId(UUIDGenerator.generate());
                    tmp.setSchoolName(schoolName);
                    tmp.setContactWay((String) getCellFormatValue(row.getCell(1)));
//                    tmp.setSchoolNature((String) getCellFormatValue(row.getCell(3)));
                    tmp.setProvince((String) getCellFormatValue(row.getCell(2)));
                    tmp.setMainType("1");
                    tmp.setType("1");
                } else {
                    schoolName = school;
                }
                EduInfo info = new EduInfo();
                info.setId(UUIDGenerator.generate());
                String collegeName = (String) getCellFormatValue(row.getCell(3));
                if (StringUtils.isNotBlank(collegeName)) {
                    college = collegeName;
                } else {
                    collegeName = college;
                }
                info.setCollege(collegeName);
                String num = (String) getCellFormatValue(row.getCell(5));
                if (StringUtils.isNotBlank(num) && StringUtils.isNumeric(num)) {
                    total += Integer.valueOf(num);
                } else {
                    num = "0";
                }
                info.setProfession(professionName);
                info.setStudentNum(num);
                info.setSchoolId(tmp.getId());
                info.setSchoolName(schoolName);
                info.setMainType("1");
                info.setType("1");
                qgbkInfo.add(info);
            }
            if (tmp != null) {
                tmp.setStudentNum(total + "");
                qgbkSchool.add(tmp);
            }
            log.info("全国本科学校：" + qgbkSchool.size());
            log.info("全国本科信息：" + qgbkInfo.size());


//            List<EduInfo> qgInfoTotal = new ArrayList<>();
//            List<EduStation> qgSchoolTotal  = new ArrayList<>();
//
//            qgSchoolTotal.addAll(qgSchool);
//            qgSchoolTotal.addAll(qgbkSchool);
//            qgInfoTotal.addAll(qgInfo);
//            qgInfoTotal.addAll(qgbkInfo);

            List<EduInfo> qgInfoSelect2 = new ArrayList<>();
            List<EduStation> qgSchoolSelect2 = new ArrayList<>();
            for (EduStation station:qgbkSchool){
                EduStation old = eduStationService.getOne(new LambdaQueryWrapper<EduStation>()
                        .eq(EduStation::getMainType,"1")
                        .eq(EduStation::getType,"1")
                        .eq(EduStation::getSchoolName,station.getSchoolName()));
                if (ObjectUtil.isNotEmpty(old)){
                    continue;
                }
                qgSchoolSelect2.add(station);
                for (EduInfo info:qgbkInfo){
                    if (!info.getSchoolId().equals(station.getId())){
                        continue;
                    }
                    qgInfoSelect2.add(info);
                }
            }

            log.info("全国本科学校 (筛选)：" + qgSchoolSelect2.size());
            log.info("全国本科信息 (筛选)：" + qgInfoSelect2.size());




            eduStationService.saveBatch(qgSchoolSelect2);
            eduInfoService.saveBatch(qgInfoSelect2);
        } catch (Exception e){
            return Result.error(e.getMessage());
        }
        return Result.ok("导入成功");

    }

    public static Object getCellFormatValue(Cell cell) {
        String value = "";
        Object cellValue = null;
        if (cell != null) {
            //判断cell类型
            switch (cell.getCellType()) {
                case Cell.CELL_TYPE_NUMERIC: {
                    if (DateUtil.isCellDateFormatted(cell)) {
                        //转换为日期格式YYYY-mm-dd
                        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
                        cellValue = format.format(cell.getDateCellValue());
                    } else {
                        //数字
                        NumberFormat format = NumberFormat.getInstance();
                        format.setMinimumFractionDigits(0);// 设置数值的小数部分允许的最小位数。
                        format.setMaximumFractionDigits(9);// 设置数值的小数部分允许的最大位数。
                        value = format.format(cell.getNumericCellValue());// 将末尾的0去掉。使单元格内容“1”，读取到的“1.00”变成“1”
                        cellValue = value.replace(",", "");
                    }
                    break;
                }
                case Cell.CELL_TYPE_FORMULA: {
                    //判断cell是否为日期格式
                    if (DateUtil.isCellDateFormatted(cell)) {
                        //转换为日期格式YYYY-mm-dd
                        cellValue = cell.getDateCellValue();
                    } else {
                        //数字
//                        cellValue = String.valueOf(cell.getNumericCellValue());
                        try {
//                            FormulaEvaluator evaluator = new FormulaEvaluator() {
//                                @Override
//                                public void clearAllCachedResultValues() {
//
//                                }
//
//                                @Override
//                                public void notifySetFormula(Cell cell) {
//
//                                }
//
//                                @Override
//                                public void notifyDeleteCell(Cell cell) {
//
//                                }
//
//                                @Override
//                                public void notifyUpdateCell(Cell cell) {
//
//                                }
//
//                                @Override
//                                public void evaluateAll() {
//
//                                }
//
//                                @Override
//                                public CellValue evaluate(Cell cell) {
//                                    return null;
//                                }
//
//                                @Override
//                                public int evaluateFormulaCell(Cell cell) {
//                                    return 0;
//                                }
//
//                                @Override
//                                public Cell evaluateInCell(Cell cell) {
//                                    return null;
//                                }
//
//                                @Override
//                                public void setDebugEvaluationOutputForNextEval(boolean value) {
//
//                                }
//                            };
//                            evaluator.evaluateFormulaCell(cell);
                            cellValue = String.valueOf(cell.getNumericCellValue());
                        } catch (IllegalStateException e) {
                            cellValue = String.valueOf(cell.getRichStringCellValue());
                        }
                    }
                    break;
                }
                case Cell.CELL_TYPE_STRING: {
                    cellValue = cell.getRichStringCellValue().getString();

                    break;
                }
                default:
                    cellValue = "";
            }
        } else {
            cellValue = "";
        }
        if ("—".equals(cellValue.toString().trim())) {
            cellValue = "";
        }
        return cellValue;
    }
//    @ApiOperation("专业简化")
//    @GetMapping(value = "/trimProfession")
    public Result<?> trimProfession(){
        List<EduInfo> list = eduInfoService.list();
        for (EduInfo info:list){
            if (StringUtils.isBlank(info.getProfession())){
                continue;
            }
            info.setProfession(info.getProfession().trim());
        }
        eduInfoService.updateBatchById(list);
        return Result.ok();
    }
}
